WordPress.org

Ready to get started?Download WordPress

Forums

Pull Down Menu of Recent Posts from a Category (4 posts)

  1. tauquil
    Member
    Posted 8 years ago #

    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.

  2. schestowitz
    Member
    Posted 8 years ago #

    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...

  3. Michael Bishop

    Posted 8 years ago #

    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.

  4. tauquil
    Member
    Posted 8 years ago #

    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>

Topic Closed

This topic has been closed to new replies.

About this Topic