• I’d like to display the most recent posts from a selected category in a pull down menu. I’ve been studying the codex/forums and have had some luck displaying categories or monthly archives in a pull down menu but not so much for recent posts from a selected category.

    Any help would be greatly appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Are you achieving this category drop-down with a plug-in at present? If so, you could modify it slightly. I am not aware of any existing plug-ins that do this, but what you want is probably something like the following.

    In the header:


    <script type="text/javascript">

    function formHandler(form){
    var URL = document.form.site.options[document.form.site.selectedIndex].value;
    window.location.href = URL;
    }

    </script>

    In the body:

    <form name="form">
    <select name="site" size=1 onChange="javascript:formHandler()">
    <option value="Get_item_1_url()">Get_item_1_title()
    <option value="Get_item_1_url()">Get_item_2_title()

    </select>
    </form>

    where item_1 is the most recent one. I don’t know the WordPress API quite so well, but you can have a look at the WordPress Codex. Maybe somebody else in the forum can complete this. Hope it helps…

    I’m sure he’s using the template tag Template_Tags/dropdown_cats. I wonder if a modified loop using query_posts would do it.

    Thread Starter tauquil

    (@tauquil)

    For the categoriese pull down menu I’m using this plugin.

    For montly archives I’m using this code, which I got from the forums:

    <form id="archiveform" action="">
    <select name="archive_chrono" onchange="window.location =
    (document.forms.archiveform.archive_chrono[document.forms.archiveform.archive_chrono.selectedIndex].value);">
    <option value=''>Select Month</option>
    <?php get_archives('monthly','','option'); ?>
    </select>
    </form>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pull Down Menu of Recent Posts from a Category’ is closed to new replies.