Drop Down (Jump Box) for Pages

Community Forums Forums Design Tips and Tricks Drop Down (Jump Box) for Pages

This topic is: resolved

This topic contains 4 replies, has 2 voices, and was last updated by  AC 1 year, 9 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #987

    AC
    Blocked
    Post count: 7712

    I have 37 pages and their links that I need to add to a drop down/jump box. Is there an easy way to do this or a plugin? They are pages on the site and it would be nice to showcase those the same way the Category Drop Down box works.

    #2938

    yakkas
    Participant
    Post count: 24

    Try this, where you include the ID’s of the pages (or you can use exclude & page ID’s)

    More info on wp_dropdown_pages

    <form name=”form1″ id=”form1″ action=”” method=”get”>
    <?php $select = wp_dropdown_pages(‘echo=0&include=31,149,20′);
    $select = preg_replace(“#<select([^>]*)>#”, “<select$1 onchange=’return this.form.submit()’>”, $select);
    echo $select; ?>
    <noscript><input type=”submit” name=”submit” value=”view” /></noscript>
    </form>


    #2940

    AC
    Blocked
    Post count: 7712

    Thank you so much for responding. Do I place that in the theme or can I put it in a widget?

     

    #2949

    yakkas
    Participant
    Post count: 24

    You can put it in a widget, if you use a plugin to allow php in widgets.

    Otherwise you can put this in a genesis hook (in this example ‘genesis_header_right’)  by adding this code to functions.php

    add_action (‘genesis_header_right’ , ‘pages_jump_menu’);

    function pages_jump_menu() {
    echo ‘<form name=”form1″ id=”form1″ action=”” method=”get”>’;
    $select = wp_dropdown_pages(‘echo=0&include=31,149′);
    $select = preg_replace(“#<select([^>]*)>#”, “<select$1 onchange=’return this.form.submit()’>”, $select);
    echo $select;
    echo ‘<noscript><input type=”submit” name=”submit” value=”view” /></noscript>’;
    echo ‘</form>’;
    }

    Or if using the simple hooks plugin, then just omit ‘add_action (‘genesis_header_right’ , ‘pages_jump_menu’);’ and add to required hook placement


    • This reply was modified 1 year, 9 months ago by  yakkas.
    • This reply was modified 1 year, 9 months ago by  yakkas.
    #2952

    AC
    Blocked
    Post count: 7712

    Oh, thank you. I really appreciate the assistance.

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

You must be logged in to reply to this topic.