• Hi, I have this loop in my category-7.php

    I would like to return just parent posts, and this below is my code which is broken… neeeeed help from some gurus here 🙂 thx

    <?php if (have_posts()) : ?>
    
    	<?php while (have_posts()) : the_post();
            if ( in_category(7) && post_is_in_descendant_category(7) ) {
        ?>
    		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    
    			<div class="post-headline">
    				<h2>
    					<a href="<?php the_permalink() ?>" rel="bookmark" title="stalni link na <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    				</h2>
    			</div>
    		    <div class="post-byline"><?php the_time("F jS, Y") ?> - <?php the_author() ?></div>
    			<div class="post-bodycopy clearfix">
    				<?php if the_content(" .. opširnije &raquo;"); ?>
    			</div>
    		</div>
    
    	<?php } ?>
    	<?php endwhile; ?>
    
    <?php if ( is_single() ) { comments_template(); } ?>
    
    <?php else : ?>
    
    	<h2 class="center">Ups..</h2>
    	<p class="center">sorry, izgleda da nisam nasao sta trazis.</p>
    	<?php get_search_form(); ?>
    
    <?php endif; ?>

    this function ‘post_is_in_descendant_category’ is in my theme folder functions.php, and I copied it from here http://codex.wordpress.org/Function_Reference/in_category

    .k

  • The topic ‘How to show just parent category, no child, help’ is closed to new replies.