How to add pages to the navigation?
-
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.
-
Easiest way is to edit the header.php files of your Home and Member themes.
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.
here’s something i have lying around. i’m not sure where i got it. not very good at records:
<?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!
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?
You can also put code in between backtick ( ` ) characters.
or use http://pastebin.com for free
here you go love.
as for backticks
, i cant seem to find it in my keyboard but i can copy yours. cool.you learn something new everyday!
Does this solution work with the selected class? so the page appears selected.
InactiveYou 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?
- The topic ‘How to add pages to the navigation?’ is closed to new replies.