• Hi All,

    I am in the middle of working on a project and seem to have hit a brick wall with something im not sure how to do.

    I need to create a dropdown list of posts to go on my website that shows all the posts i have created in every category. I have managed to find this: https://www.dagondesign.com/articles/drop-down-post-list-plugin-for-wordpress/which works well but only shows posts from one single category.

    Does anyone know any code i could use or manipulate to get the list to show all posts?

    I have managed to get a temporary fix for the problem by creating a category all putting all the posts under it, but i dont really want to go ahead with that because the search engines seem to index the wrong URL for it.

    Any help is appreciated, thanks.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Try this :

    <select name=\”archive-dropdown\” onChange=’document.location.href=this.options[this.selectedIndex].value;’>
    <option value=\”\”><?php echo attribute_escape(__(‘Select Post’)); ?></option>
    <?php wp_get_archives(‘type=postbypost&format=option&show_post_count=0’); ?> </select>

    I hope this helps ??

    Thread Starter kwills7

    (@kwills7)

    That works thanks! is there anyway i can change that to show the post title instead of the date?

    Thanks again

    I’ve edited the above code.

    When you use postbypost it shows the title instead of date ??

    Thread Starter kwills7

    (@kwills7)

    it works!, Cheers for that, much appreciated!

    Thread Starter kwills7

    (@kwills7)

    Just one more thing,

    I have another dropdown with the following code:

    <?php wp_dropdown_categories(‘show_option_none=Select a Category&show_count=1’); ?>

    <script type=”text/javascript”><!–
    var dropdown = document.getElementById(“cat”);
    function onCatChange() {
    if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
    location.href = “<?php echo get_option(‘home’);
    ?>/?cat=”+dropdown.options[dropdown.selectedIndex].value;
    }
    }
    dropdown.onchange = onCatChange;
    –></script>

    it displays categories with posts within it, is there some way i can manipulate that to show all the categories even if they don’t have a post within it?

    Thanks for this, you are saving me a lot of headache!

    Edit:

    You should use hide_empty=0

    <?php wp_dropdown_categories(‘show_option_none=Select a Category&show_count=1&hide_empty=0’); ?>

    Thread Starter kwills7

    (@kwills7)

    brilliant, thanks for your help :o)

    No problem. Glad you could use it ??

    Thread Starter kwills7

    (@kwills7)

    sorry, just ONE more last thing i promise!

    the dropdown code you have just listed is fine… i just need it now to show the “uncategorised” category…

    Is this possible?

    Thanks again

    Well the code i gave you above should list all categories you have. But given that the uncategorised category is there in default you might have to delete it and create your own uncategorised category.

    Thread Starter kwills7

    (@kwills7)

    OK, thanks for your help, i’ll leave you alone now.

    hi, i read the posts. but i could not understand. there are lots of php codes here. ??

    For example, there are 2 categories that named “A” and “B”. when you login the A category, i want dropdown plugin to show the post of “A” category. when you click the category “B”, i want to dropdown to show the post of category “B is that possible?

    plz help

    sorry?

    `<?php wp_dropdown_categories(‘show_option_none=Select a Category&show_count=1’); ?>

    <script type=”text/javascript”><!–
    var dropdown = document.getElementById(“cat”);
    function onCatChange() {
    if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
    location.href = “<?php echo get_option(‘home’);
    ?>/?cat=”+dropdown.options[dropdown.selectedIndex].value;
    }
    }
    dropdown.onchange = onCatChange;
    –></script>`

    is that code is workin?

    What if I just wanted to display all posts under one specific category (i.e. hacks).

    Thank you

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Dropdown Posts List’ is closed to new replies.