Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to add pages to the navigation?


  • kevinheath
    Participant

    @kevinheath

    I want to add and “about” page and have it listed in the horizontal navigation where we currently have”home”, “blog”, “members” etc.

    I have created a new page but cannot find how to get it on the nav.

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

  • John James Jacoby
    Keymaster

    @johnjamesjacoby

    Easiest way is to edit the header.php files of your Home and Member themes.


    kevinheath
    Participant

    @kevinheath

    Oh – I see. I was hoping it would be dynamic.

    I’m a CSS and PHP newbe, but that’s how to learn I guess.


    alunsina
    Participant

    @alunsina

    here’s something i have lying around. i’m not sure where i got it. not very good at records:

    :D


    <?php

    function add_about_to_main_menu() {

    $class = (bp_is_page(‘about’)) ? ‘ class=”selected” ‘ : ”;

    echo ‘<li ‘ . $class. ‘>‘ . __( ‘About’, ‘buddypress’ ) .’‘;

    }

    add_action(‘bp_nav_items’,’add_about_to_main_menu’);

    ?>


    end here.

    create this as something like aboutmenu.php then edit the link (href part). this way you wont have to muck around the theme files.

    hope that helped!


    alunsina
    Participant

    @alunsina

    ohh, geez, sorry, i dont know how to paste a code. dont copy that, its not showing everything. but hope you get the idea.

    Could you just add <?php wp_list_pages(); ?> to the header.php file?

    https://codex.wordpress.org/wp_list_pages


    belogical
    Participant

    @belogical

    You can also put code in between backtick ( ` ) characters.

    or use http://pastebin.com for free


    alunsina
    Participant

    @alunsina

    here you go love.

    http://pastebin.com/m1eabe556

    as for backticks, i cant seem to find it in my keyboard but i can copy yours. cool.

    you learn something new everyday!


    plunderpat808
    Participant

    @plunderpat808

    Does this solution work with the selected class? so the page appears selected.


    2864451
    Inactive

    You an do this but then you get the word “pages” stuck in your Menu. With the pages dropping dow to the right hand side.

    I’ve tried that other code but don’t understand what it means, do you mean add that as a php file to the theme and then make a referenc eto it in header.php?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to add pages to the navigation?’ is closed to new replies.
Skip to toolbar