• I have two categories, Newsletters and Events. The code below works perfectly except it displays post titles from both categories and I only want it to display the post titles from the category Newsletters.

    <select name="archive-dropdown"
        onChange='document.location.href=this.options[this.selectedIndex].value;'>
    	<option value=""><?php echo attribute_escape(__('Select Newsletter')); ?></option>
    	<?php wp_get_archives('type=postbypost&format=option&show_post_count=1'); ?>
       </select>

    I have been reading and experimenting for hours on this with no luck. I have tried to integrate many variations of a query_posts code(below) into the <select> section using something like this:

    <?php query_posts('category_name=Newsletters'); ?>
    	<?php if ( have_posts() ) : ?>
    		<?php while ( have_posts() ): the_post(); ?>
    		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
              <div> <?php the_content('' . get_the_title('', '', false)); ?> <br /></div>
    		</div>
    		<?php endwhile; ?>
    	<?php endif; ?>
    	<?php wp_reset_query(); ?>

    My ancient neurons are misfiring badly! Any help would be greatly appreciated.

    Michael

  • The topic ‘Display all posts from specifc category in dropdown’ is closed to new replies.