• Resolved toto

    (@toto)


    Hello to all friends. Pls help. I want to show header for block of posts, and the header will be visible only if have posts in catecory. How to make it.

    example: in my sidebar i call some posts from cat4
    backticks
    <?php query_posts(‘cat=4&showposts=3’); ?>
    <ul.><?php while (have_posts()) : the_post(); ?>
    <.li>“><?php the_title(); ?></li.><?php endwhile;?></ul.>
    backticks

    i thing the code may look like this:
    backticks

    <?php query_posts(‘cat=4&showposts=3’); ?>
    <?php while (have_posts()) : the_post(); ?>
    <h2>Section header</h2><.ul>
    <.li>“><?php the_title(); ?></li.><?php endwhile;?></ul.>backticks

    but if i use this code, the header and the ul tag is duplicated!?

    So how to set header that will NOT be duplicated and NOT be visible if cat4 dont have any posts?

    pls help and many thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • <?php query_posts('cat=4&showposts=3'); ?>
    	<?php if (have_posts()) : the_post(); ?>
    		<h2>Section header</h2>
    	<?php endif; ?>
    
    <?php query_posts('cat=4&showposts=3'); ?>
    <ul>
    	<?php while (have_posts()) : the_post(); ?>
    		<li><?php the_title(); ?></li>
    	<?php endwhile;?>
    </ul>
    Thread Starter toto

    (@toto)

    thanks a lot ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Head of sidebar post – diplicated’ is closed to new replies.