WordPress.org

Ready to get started?Download WordPress

Forums

BuddyPress Album
How are templates selected (2 posts)

  1. brentgracey
    Member
    Posted 2 years ago #

    Hi - I can't quite see how bp-albumn determines which template file to use.

    For example - navigating to /wordpress/members/admin/album/ results in the wordpress/wp-content/plugins/bp-album/includes/ templates/album/pictures.php template being used.

    I can't determine where it works out that this is the filter, and then how it tells WP or BP that this is the one that should be use.

    Any tips on how I should investigate this will be appreciated.

    I've seen the below comment in the readme, but don't know where the examples it is referring to are located.

    "For more information, see the functions bp_example_load_template_filter() for how template locations
    are filtered, and bp_example_screen_one() for how they are loaded for a screen (all in bp-example-core.php)"

    Cheers

    http://wordpress.org/extend/plugins/bp-album/

  2. brentgracey
    Member
    Posted 2 years ago #

    I have made some progress on this.

    A simple skeleton component (component being a buddypress plugin) is given at http://wordpress.org/extend/plugins/buddypress-skeleton-component/

    A plugin needs to extend BP_Component, and will during its construction include a list of files.

    Filters can be added to "bp_located_template" - and in the skeleton example there is the below code which is the start of selecting a custom template for a specific URI

    /**
    * Only filter the template location when we're on the example component pages.
    */
    if ( $bp->current_component != $bp->example->slug )

    Haven't quite been able to been able to work out exactly how bp-albumn is doing this, but prob along the same lines.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic