Show only Post titles with thumbnails in category pages

Discussion in 'WordPress' started by viveknathr, Jan 12, 2013.

  1. #1
    In my category page full post are showing up. I want to make it only post titles with tumbnails. I'm using wordpress Twenty twelve theme.
     
    viveknathr, Jan 12, 2013 IP
  2. phxadam

    phxadam Well-Known Member

    Messages:
    229
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    128
    #2
    Paste the code you are using now. You are going to want to remove the_content and add something like this where you want the thumbnail to go
    <?php postimage('thumbnail'); ?>
    PHP:
     
    phxadam, Jan 20, 2013 IP
  3. phxadam

    phxadam Well-Known Member

    Messages:
    229
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    128
    #3
    oops forgot to mention. for <?php postimage('thumbnail');?> to work, add this to header.php
    <?php
    function postimage($size=thumbnail) {
    if ( $images = get_children(array(
    'post_parent' => get_the_ID(),
    'post_type' => 'attachment',
    'numberposts' => 1,
            'order' => 'ASC',
            'orderby' => 'ID',
    'post_mime_type' => 'image',)))
    {
    foreach( $images as $image ) {
    $attachmenturl=wp_get_attachment_url($image->ID);
    $attachmentimage=wp_get_attachment_image( $image->ID, array(300,500));
     
    echo $attachmentimage;
    }
    } else {
    echo "No Image";
    }
    }
    ?>
    PHP:
     
    phxadam, Jan 20, 2013 IP
  4. viveknathr

    viveknathr Member

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #4
    I used CSS to hide contents in category pages. Here is what I added.
    .category .entry-content, .category .entry-summary, .archive .entry-content, .archive .entry-summary { display: none; }
    My blog link http://www.digitaladvices.com/
     
    viveknathr, Jan 20, 2013 IP
  5. ninjamtlt1

    ninjamtlt1 Active Member

    Messages:
    1,704
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    88
    #5
    There should be a plugin for that if I'm not mistaken.
     
    ninjamtlt1, Jan 22, 2013 IP