Grow your CSS skills. Land your dream job.

wp_page_menu

  • # September 23, 2011 at 4:45 pm

    Hi all,

    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?

    Thanks,

    jr

    # September 23, 2011 at 5:04 pm

    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.

    # September 23, 2011 at 8:02 pm

    Perfect! Thanks for the help. I was missing the need to define the array separately.

    # September 26, 2011 at 12:43 am

    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.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".