Skip to:
Content
Pages
Categories
Search
Top
Bottom

[edited -modemlooper] How to add custom component pages


  • mikegarlick
    Participant

    @mikegarlick

    I want to add a new blank section like the existing Activity, Profile, Group, Forum etc… where i can add my own code/functionality.

    how do i do this?

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

  • giannisff
    Participant

    @giannisff

    Hello there
    If it is a single page, you have to create a new page from the admin dashboard, give it a name and call it from your menu.


    mikegarlick
    Participant

    @mikegarlick

    How would I call it to sit alongside the other sections (activity/profile/groups etc..)

    This new section after i finish coding it will be a file upload section for images that i then can call on later to output in various jquery slideshows. I dont just want a blank page.

    hope that makes sense?


    mikegarlick
    Participant

    @mikegarlick

    I have literally search for days and days to find a straight forward way to do this. Why is this not a more common request?? It seems natural to need/want to add sections to your bp profiles. I dont want to use the plugins i have found as they dont do what I want. Its becoming really frustrating to solve this issue.


    modemlooper
    Moderator

    @modemlooper

    function my_new_setup_nav() {
    bp_core_new_nav_item( array(
    ‘name’ => ‘Photo Uploads’,
    ‘slug’ => ‘photo-uploads’,
    ‘screen_function’ => ‘your-function-to-display-page’,
    ‘position’ => 55
    ) );
    }
    add_action( ‘bp_setup_nav’, ‘my_new_setup_nav’, 100 );

    function your-function-to-display-page() {
    //code here that shows content when on the Photo Uploads page
    }


    mikegarlick
    Participant

    @mikegarlick

    where would i put that? if its in the functions.php file can i not have a seperate for the content of that page?


    mikegarlick
    Participant

    @mikegarlick

    sorry. thank you for the reply by the way.


    modemlooper
    Moderator

    @modemlooper

    No, functions.php should only be used for code that effects the theme layer. Use https://codex.buddypress.org/developer/extending-buddypress/bp-custom-php/


    mikegarlick
    Participant

    @mikegarlick

    is the codex site for buddypress always down? i can’t access that site at all?


    modemlooper
    Moderator

    @modemlooper

    To use a file for the page content you do a locate template in the function instead of putting the actual code in the function.

     

    Get the BuddyPress skeleton component plugin. It has commented code to show you how to create custom BuddyPress components. Though, you can utilize simple wordPress page templates to accomplish a page with custom content. If the content doesnt need to be initiated into the active components then a page will do.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[edited -modemlooper] How to add custom component pages’ is closed to new replies.
Skip to toolbar