WordPress.org

Support

Support » Themes and Templates » [Resolved] category last 3 posts List with thumbnais

[Resolved] category last 3 posts List with thumbnais

  • redouanedev

    @redouanedev

    Hello everyone ! thank you for your help !
    i want add 2 boxes to the homepagge of the theme displayin the last 3 posts for a specefic categories that i want .just a post title with a thumbnail ( 60 x 60 px )
    this is the image explaining what i want exactley and thank you for your Help

    http://dl.dropbox.com/u/9421957/categoryPostList.jpg

Viewing 7 replies - 1 through 7 (of 7 total)
  • Michael

    @alchymyth

    redouanedev

    @redouanedev

    thanks i tried but lot of coding oooh im beginner

    Michael

    @alchymyth

    what theme are you using?

    can you post a link to your site to illustrate what you have so far?

    have you tried to use the forum search?
    similar problems have been asked and solved before.

    redouanedev

    @redouanedev

    i use silverOrchid theme from gazpo
    and i want change the loop with boxes each one for a specefic category with 3 or x latst posts with thumbnails 60 x 60 .
    i use a localhost as a server web . thank you for your help

    Michael

    @alchymyth

    per category, try this general structure (you will need to add more html tags and css classes for easier formatting; posts are output as an unordered list):

    <?php $catname = 'what-ever-cat-slug';
    $cat_query = new WP_Query( array(
     'posts_per_page' => 3,
     'category_name' => $catname,
     'meta_key' => '_thumbnail_id'
    ));
    if( $cat_query->have_posts() ) :
     $cat = get_term_by('slug',$catname,'category');
     echo $cat->name;
     echo '<ul>';
     while( $cat_query->have_posts() ) : $cat_query->the_post();
      echo '<li>';
      the_post_thumbnail(array(60,60));
      echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a>';
      echo '</li>';
     endwhile;
     echo '</ul>';
    endif; wp_reset_postdata();
    ?>

    (untested)

    make a backup copy of your theme before editing.

    redouanedev

    @redouanedev

    woow alchymyth ! worked so greaaaaaaaaaaat ! thank youuuuuuu

    and to add a expect text post ?

    redouanedev

    @redouanedev

    THANKS FOR YOUR HELP , SOLVED !

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] category last 3 posts List with thumbnais’ is closed to new replies.
Skip to toolbar