[buddypress-trac] [BuddyPress] #4855: Method to override a plugins use of plugins.php or add filters to bp_template_title and bp_template_content
buddypress-trac
noreply at wordpress.org
Fri Mar 1 22:31:49 UTC 2013
#4855: Method to override a plugins use of plugins.php or add filters to
bp_template_title and bp_template_content
-------------------------+-----------------------------
Reporter: modemlooper | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Core | Version:
Severity: normal | Keywords: 2nd-opinion
-------------------------+-----------------------------
Yes, another plugins.php related ticket.
Filtering bp_get_template_part works unless page is calling plugins.php.
bbPress uses plugins.php and if you wanted to override the page you can't
call plugins.php. If you do, your content and bbPress (or whatever plugin)
content displays together.
This is needed because we are no longer relying on themes to display
content. You can call a different template file for that part but it
breaks a theme if the plugins.php you are calling is not matching the
themes plugin.php. This is mainly an issue if the theme has a custom
plugins.php file or you want to display different content than what a
plugin is pushing through plugins.php
What we should be able to accomplish: Even if a plugin is using
plugins.php we should be able to override bp_template_title and
bp_template_content. add filters to bp_template_title and
bp_template_content?
Maybe there is a method and I'm missing something.
Here is an example and it seems silly to remove a template file to simply
replace it.
{{{
function my_template_filter_init() {
add_action( 'bp_template_title', 'my_filter_template_title' );
add_action( 'bp_template_content', 'my_filter_template_content' );
add_filter( 'bp_get_template_part', 'my_template_part_filter', 10, 3 );
}
add_action('bp_init', 'my_template_filter_init');
function my_template_part_filter( $templates, $slug, $name ) {
if ( 'members/single/plugins' != $slug )
return $templates;
return bp_get_template_part( 'members/single/plugins' );
}
function my_filter_template_title() {
echo 'Title';
}
function my_filter_template_content() {
echo 'Content';
}
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4855>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list