Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to include the global $bp variable within newly created directory within my current theme.

  • So I created a new folder to support my listings functionality for my website. The one issue is that I need to use the global $bp variable to access the currently logged in user’s id (which I know how to access already.) My question is… what file(s) do I need to include or what concrete steps do I need to take in order to be able to use the global $bp variable. I already know about bp-custom.php and functions and the ability to use $bp here. But I would prefer not to do this for the sake of organizing and separating functionality on my site.
    Any help would be greatly appreciated.
    Thanks in advance.
    -Alex

Viewing 2 replies - 1 through 2 (of 2 total)
  • One thing I forgot to mention…the listings functionality I would like to store in a folder that is located either within my current themes directory or somewhere within the buddypress plugin directory. Either location doesn’t matter as long as a separate folder exists.
    Thanks again.
    -Alex

    Just put “global $bp;” in the PHP above where you need to use it. It’s better to find a function that provides the information you need directly, rather than accessing globals like this (though it’s a perfectly valid thing to want to do).

    For example, to get the logged in user’s ID: get_current_user_id()

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to include the global $bp variable within newly created directory within my current theme.’ is closed to new replies.
Skip to toolbar