Skip to:
Content
Pages
Categories
Search
Top
Bottom

Why is userbar.php loaded from the header in 1.2?


  • peterverkooijen
    Participant

    @peterverkooijen

    Why is userbar.php loaded from the header in 1.2?

    In 1.0 it was loaded in the template pages with bp_get_userbar(), but that function apparently doesn’t exist anymore. What are the advantages of the new approach. Would I get in trouble if I fall back on the old approach, probably by adding bp_get_userbar() to functions.php?

    I need to figure out how to upgrade this in my custom template…

    EDIT:

    I now have this straight in template files – and removed the same lines from header.php:

    <?php locate_template( array( 'userbar.php' ), true )  ?>
    <?php locate_template( array( 'optionsbar.php' ), true ) ?>

    Couldn’t I just use a regular include here? Why locate_template etc.? What does this do?

Viewing 4 replies - 1 through 4 (of 4 total)

  • Mike Pratt
    Participant

    @mikepratt

    Well…I see it called in bp_sn_parent but it’s not called in the default theme’s header so I am wondering where I can even take a look at it in use


    Mike Pratt
    Participant

    @mikepratt

    As for locate_template() – you’re best suited to go read about the function yourself than ask it here. It’s a WP function. I founded via Google, the search engine @ https://codex.wordpress.org/Function_Reference/locate_template

    It’s a better function to use than an include because the array of template files gives the function something to fall back on if it can’t find the sought after function.


    peterverkooijen
    Participant

    @peterverkooijen

    Mike Pratt, I know what a search engine is. I’m not a programmer though, so the information for locate_template in the codex doesn’t mean much to me.

    I know html/css and basic php things like includes. I’m working on upgrading my theme and this is one example where more complicated php mixed in with the html is causing me headaches.


    Mike Pratt
    Participant

    @mikepratt

    then your best bet is to load the parent and new default themes and tweak the default to suit your needs. But I admit to reading your older posts and either you’re faking it well by pasting in a bunch of code to make it look you you know a thing or two about programming, or you know more than you’re leading us to believe. Either way, I’m sure this makes sense to even a non-programmer like yourself:

    Retrieve the name of the highest priority template file that exists.

    Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which inherit from a parent theme can just overload one file.

    from the Description of locate_template()

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Why is userbar.php loaded from the header in 1.2?’ is closed to new replies.
Skip to toolbar