Displaying post titles from specific category in WordPress -


i display few post titles specific category on homepage. first 1 have small thumbnail , excerpt , rest of them title. below section have link clicking on show posts under category.

like http://i.stack.imgur.com/n5jua.jpg

as arslaan ejaz said, can use wp_query. think answer not enough question. want show first post thumbnail , others titles right?. can done php count. here using on site. check below code, show first post thumbnail, title , excerpt, other 3 posts title category id 1.

<div class="main-div"> <div class="thumbnaildiv"> <?php $count=1; $query = new wp_query('showposts=4&cat=1&offset=0'); if ($query->have_posts()) : ?> <?php while ($query->have_posts()) : $query->the_post(); ?>  <?php if($count==1){ ?>      <h2>         <a href="<?php the_permalink() ?>" rel="bookmark">         <?php the_title(); ?></a>    </h2>    <div class="thumb">         <a href="<?php the_permalink(); ?>">         <?php the_post_thumbnail('thumbnail'); ?>         </a>         <p><?php the_excerpt(); ?> ...</p>    </div> </div><!--div thumbnail, title, , excerpt end--> <div style="clear:both"></div>    <div class="without-thumb">        <ul>        <?php } if($count>1){ ?>             <li>                <a href="<?php the_permalink() ?>" rel="bookmark">                <?php the_title(); ?></a>            </li>       <?php }  if($count==4){ ?>       </ul>       <?php } ?>       <?php $count++; endwhile; else: endif; wp_reset_postdata(); ?>     </div><!--div without thumbnail end--> </div><!--main div end--> 

the div's have used information purpose only. can change , style desired.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -