How to prevent post entries, unless otherwise indicated tags for the post?

link|improve this question
feedback

1 Answer

You can keep them from showing by using something like this:

<?php
/* 
 Template Name: Tags
*/
?>
<?php get_header(); ?>
<div id="posts">
  <?php
  if( has_tag() ) {
  if (have_posts()) : ?>  
      <?php while (have_posts()) : the_post(); ?>  
          <?php the_content('Read the rest of this entry'); ?>  
      <?php endwhile; ?>  
      <?php else : ?>   
  <?php endif; } else { ?>
    <h2 id="no-tags">
      <a href="<?php echo get_option('home'); ?>">Back Home</a>
    </h2>
  <?php } ?>
</div>
<?php get_footer(); ?>

That is a very simple template just for this example. It would return a link to the home page if no tags were set. You could customize it to do something else.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.