Working for one of my client he had a very unique requirement. “He wanted to show all the posts in his blog as a combo box where user can select any post and visit that post”.
Could not find anything and so I had to do the coding myself but when I used the default WordPress looping functions it had some issues on the category pages and the loop to show all posts interfered with the main page loop and so I had to do a new looping.
The below code will not interfere with any of the existing loops in the page and can even be used on 404 error pages.
<script language="JavaScript">
<!--
function gotourl() {
// JavaScript function to change the user to the url of the author
theSel = document.getElementById("AllPosts").value;
if ("" != theSel) location.href = theSel;
}
//-->
</script>
<?php
$featuredPosts = new WP_Query();
$featuredPosts->query('showposts=-1');
?>
<select id="AllPosts" name="AllPosts" onChange="gotourl();"><option>Select Your Celebrity</option>
<?php
while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); ?>
<option value="<?php the_permalink() ?>"><?php the_title(); ?></option>
<?php endwhile; ?>
</select>
Enjoy!!!
But if you are not planning to subscribe through Email. Try subscribing to RSS.

{ 2 comments… read them below or add one }
Awesome post! It really helped me a lot! Thanks for sharing it.
The pleasure is all mine.