I’m working with a WordPress site and I’m trying to use the wp_page_menu function to display the home page as “Blog” and list two other pages using the &include argument by their ID number. The correct syntax is alluding me.
Any input is greatly appreciated.
WordPress Codex page
This is the code for showing the home page as ‘Blog’
< ?php wp_page_menu( array( 'show_home' => 'Blog') ); ?>
How do I add the &include argument into this?
You could do:
If you’re going to use an array, I like setting it up like WordPress suggests:
< ?php $args = array(
'include' => '2,3,4',
'show_home' => 'Blog' );
< ?php wp_page_menu( $args ); ?>
Little easiesr to see what’s going on.
Perfect! Thanks for the help. I was missing the need to define the array separately.
I’m not sure if you have to define it separately, I just like to do that for ease of reading. I think it’s that you were missing a semicolon after ‘Blog’).
< ?php wp_page_menu( array( 'show_home' => 'Blog'); ); ?>
That might work, too.
You must be logged in to reply to this topic.
*May or may not contain any actual "CSS" or "Tricks".