Support » Themes and Templates » category display

  • I’m developing an image driven portfolio site which will be navigated by post categories.
    i’m using and editing the very minimal toolbox theme.
    when a category link (like “posters”) is clicked, i want the poster category page to display one thumbnail image each for all the posts with that category. (Most posts have multiple images.) Also I don’t want a grid/table display, but just all the thumbnail images flowing next to each other.
    I’m not quite fluent enough in php to figure out how to edit the category.php so that it will produce this result.
    any suggestions?
    thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You’ll need to set the featured image of each post, then edit category.php to display a featured image of the post by adding the_post_thumbnail(‘thumbnail’); within the loop. If you have content to display before a gallery, just enter the <!– more –> tag after the content and before the [gallery] in the post.

    Edit: I may have misunderstood what you’re fully asking, let me know and I’ll modify my answer for you =)

    Thread Starter jackhenrie

    (@jackhenrie)

    by featured image, do you mean excerpt?
    (it would be great if i could select a thumbnail for the category page that was NOT the first image in the post.)

    here’s a site that displays a category page in the way i want:
    http://www.sulki-min.com/wp/?cat=15

    so i’m wondering how to edit my category.php to get this layout….

    thanks again

    No not the excerpt. WordPress has a feature to set featured images on each post, but this may not be turned on or may be disabled in the theme you are using. If that is the case, you’ll need to add the following to your theme’s functions.php file…

    add_theme_support( 'post-thumbnails' )

    Then you should be able to assign featued images to posts. And in category.php you’ll need to rearrange things so that it’s not displaying the_excerpt() or the_content() and instead use one of the following based on the image size you want to display…

    the_post_thumbnail('thumbnail');       // Thumbnail (default 150px x 150px max)
    the_post_thumbnail('medium');          // Medium resolution (default 300px x 300px max)
    the_post_thumbnail('large');           // Large resolution (default 640px x 640px max)
    the_post_thumbnail('full');            // Full resolution (original size uploaded)

    To get the image layout like on the site you provided, you’d have to edit the css of the post blocks to lay the posts out how you want them, based on your theme the divs that wrap the posts will most likely be different, so it’d take a little work.

    Thread Starter jackhenrie

    (@jackhenrie)

    thanks!

    where in functions.php should i paste

    add_theme_support( 'post-thumbnails' )

    ?

    (i just tried it and got an error.)

    and, where in category.php do i replace the_content() with the_post_thumbnail('thumbnail')?

    here’s the loop in my category.php:

    <?php /* Start the Loop */ ?>
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php
    						get_template_part( 'content', get_post_format() );
    					?>
    
    				<?php endwhile; ?>

    …can’t find the_content ……….

    sorry, make sure you put the ; so that it is add_theme_support( ‘post_thumbnails’ );

    probably errored because of the missing ;

    As for the other, your theme loads in additional files to display the actual content, get_template_part( ‘content’, get_post_format() ); loads a template file within your theme’s directory. Based on that, you should have a file in your theme’s directory named something like… content-post.php or content.php.

    This is where things would get tricky however, because that file could be called to load content on other pages. So you’d have to view the code of that file to find the proper place to put it. Without knowing the content of that template file, I can’t tell you exactly.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘category display’ is closed to new replies.