• Resolved jonathas_scott

    (@jonathas_scott)


    First of all thnk you all so much for the help and cush a great app that is wordpress.

    I′m trying to print a certain category post, but as im new to wp and php i can′t figure it out why my try is not working.. please anyone?

    <?php if(have_posts() && is_category('3')) : ?>
    	<?php while(have_posts()) : the_post(); ?>
        <div id="featured">
        <h2>FEATUREDWORK</h2>
            <div class="imageElement" id="post-<?php the_ID(); ?>">
                <div class="lead-image-wrapper">
                    <h2><?php the_title(); ?></h2>
                    <h3><?php the_excerpt_rss(10,2); ?></h3>
                    <h4><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">+ Details on this project</a></h4>
                </div>
                <!-- img from rss trick -->
    	        <?php //the_excerpt_rss(0); ?>
            </div>
            <p class="posted_on">Posted on 18 March 2008- <?php single_cat_title(); ?> - </p>
    
         </div>
       <?php endwhile; ?>
       <?php endif; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • in_category not is_category for single post!

    Read the Docs: Conditional_Tags#A_Category_Page – see the last condition.

    Thread Starter jonathas_scott

    (@jonathas_scott)

    Thanks a LOT moshu !!!
    
    But i could only make it happen like this:
    ........
    	<?php if(have_posts()) : ?>
    		<?php while(have_posts()) : the_post(); ?>
                <?php if(in_category('3')) : ?>
                <div id="featured">
                <h2>FEATUREDWORK</h2>
                    <div class="imageElement" id="post-<?php the_ID(); ?>">
                        <div class="lead-image-wrapper">
                            <h2><?php the_title(); ?></h2>
                            <h3><?php the_content(); ?></h3>
    	                    <h4><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">+ Details on this project</a></h4>                        <!-- img from rss trick -->
    						<?php the_excerpt_rss(0); ?>
                        </div>
                    </div>
                 </div>
               <?php endif; ?>
           <?php endwhile; ?>
       <?php endif; ?>

    Any especial reason for it ?

    Thankyou -> Obrigado ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘IF in category post’ is closed to new replies.