How to add a slug to nav and link to a WPMU page
-
Hi all!
I’m feeling quite proud of myself this evening and just had to share this.
Thanks to the great folks in these here forums, I (a true-blue php-dummy) figured out how to add a new slug to the main navbar, link it to a WPMU page and highlight the slug when on the page. Hooray!
1 – Define the slug in wp-config.php, just before the line where it says “Stop Editing!” like so:
define ( “BP_PAGE_SLUG”, ‘wpmu-page-name‘ );
2 – Add the slug into header.php (somewhere around line 87) like so:
<li<?php if ( is_page( BP_PAGE_SLUG ) ) : ?> class=”selected”<?php endif; ?>>/<?php echo BP_PAGE_SLUG ?>” title=”<?php _e( ‘Slug Label‘, ‘buddypress’ ) ?>”><?php _e( ‘Slug Label‘, ‘buddypress’ ) ?>
3 – Make sure that ?php if ( bp-is_page is truncated to ?php if ( is_page
Removing the “bp-” ensures that, when linking to a WPMU created page, the slug is properly highlighted when on that page.
It works. Thanks to all who contribute here. Now I can go to bed a little more knowledgeable.
- The topic ‘How to add a slug to nav and link to a WPMU page’ is closed to new replies.