Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: create subnav not working with child theme


warut
Participant

@warut

this code working with child theme (working but show error) but get another error

@r-a-y is it correct method using locate_template()?

Warning: Cannot modify header information – headers already sent by (output started at /home/tripsbuz/public_html/wp-content/themes/bp-default/header.php:3) in /home/tripsbuz/public_html/wp-includes/pluggable.php on line 868


code


function bp_badge_load_template_filter( $found_template, $templates ) {

global $bp;

if ( $bp->current_component != $bp->profile->slug && $bp->current_action !=‘badge’)

return $found_template;

locate_template( $templates, true );

}

add_filter( ‘bp_located_template’, ‘bp_badge_load_template_filter’, 10, 2 );

function bp_gifts_load_subtemplate( $template_name ) {

if ( file_exists(STYLESHEETPATH . ‘/’ . $template_name . ‘.php’)) {

$located = STYLESHEETPATH . ‘/’ . $template_name . ‘.php’;

echo STYLESHEETPATH . ‘/’ . $template_name . ‘.php’;

} else if ( file_exists(TEMPLATEPATH . ‘/’ . $template_name . ‘.php’) ) {

$located = TEMPLATEPATH . ‘/’ . $template_name . ‘.php’;

echo TEMPLATEPATH . ‘/’ . $template_name . ‘.php’;

} else{

$located = dirname( __FILE__ ) . ‘/templates/’ . $template_name . ‘.php’;

//echo dirname( __FILE__ ) . ‘/templates/’ . $template_name . ‘.php’;

}

include ($located);

}

function bp_badge_screen() {

global $bp;

do_action( ‘bp_badge_screen’ );

bp_gifts_load_subtemplate( apply_filters( ‘bp_badge_template_screen’, ‘badge/screen’ ), true );

}

Skip to toolbar