Viewing 5 replies - 1 through 5 (of 5 total)
  • Straight off wordpress loop page – where it says in_category(‘3’), put the category ID of ones you DON’T want to show. if you want to restrict more than one, put

    in_category(‘3’) || in_category(‘4’) || in_category(‘5’)

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
     <!-- If the post is in the category we want to exclude, we simply pass to the next post. -->
     <?php if (in_category('3')) continue; ?>
    
     <div class="post">
    
      <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    
      <small><?php the_time('F jS, Y'); ?></small>
    
      <div class="entry">
        <?php the_content(); ?>
      </div>
    
      <p class="postmetadata">Posted in <?php the_category(', '); ?></p>
     </div> <!-- closes the first div box -->
    
     <?php endwhile; else: ?>
     <p>Sorry, no posts matched your criteria.</p>
     <?php endif; ?>
    Thread Starter l3luemage

    (@l3luemage)

    No no I want it to show the title only and possibly date and they click the title to go to the post.

    For example this

    <h2><?php _e('Latest Highlights'); ?></h2>
    	<ul><?php wp_get_archives('type=postbypost&limit=5'); ?></ul>

    Shows all latest post titles. But I want it to only show the post titles from that certain category…and if possible add in the date it was posted also.

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
     <!-- If the post is in the category we want to exclude, we simply pass to the next post. -->
     <?php if (in_category('3')) continue; ?>
    
      <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    
      <small><?php the_time('F jS, Y'); ?></small>
    
     <?php endwhile; else: ?>
     <p>Sorry, no posts matched your criteria.</p>
     <?php endif; ?>
    Thread Starter l3luemage

    (@l3luemage)

    Okay and last thing XD How do you make it so it only shows latest 5? 😐 -is still learning all this php stuff haha

    Set that in options.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Filter’ is closed to new replies.