• steve35mm

    (@steve35mm)


    I’ve been struggling with this for a couple of weeks now, so I’m really hoping someone can help me out. I’m utilizing Press75’s Single Post Thumbnail plugin. It’s been working great for all scenarios except one…

    I’m using WordPress’s category templates (category-ID.php) to style my category archive pages dynamically.
    https://codex.www.ads-software.com/Category_Templates

    I’ve successfully implemented thumbnails for a normal category listing, i.e. archive.php, but when I try to display them on, let’s say, category-156.php, the thumbnails do not display. Same code, same structure, same everything. It breaks if I simply rename the file from archive.php to category-156.php

    Oddly enough, the renamed template WILL display the default thumbnail I have setup in the WP admin.

    I really need this to work because this site requires that I paginate hundreds of postings (12 per page).

    Any help would be much appreciated.

    Here’s my code for category-156.php…
    (Once again, this works for standard archive pages, but not for category templates. Very strange.)

    If anyone needs me to include more details or code to diagnose, just let me know and I’d be glad to post.
    =========================

    <?php
    /**
    Template Name: Video Interview Archive
    */
    
    get_header();
    ?>
    
    <div id="content-wrap" class="buzz clearfix">
      <div id="content">
        <div id="archive-buzz">
          <div class="archive-dd">
            <h3 class="browsemonth">Browse by Month</h3>
            <select name="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'>
              <option value=""><?php echo attribute_escape(__('Select Month')); ?></option>
              <?php wp_get_archives('cat=156&type=monthly&format=option&show_post_count=1'); ?>
            </select>
          </div>
        </div>
        <div id="wrap">
          <div class="more-vids">
            <?php if (have_posts()) : ?>
            <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
            <?php while (have_posts()) : the_post(); ?>
            <div <?php post_class() ?>>
              <h2 class="archive" id="post-<?php the_ID(); ?>"><span class="comment-bubble"><a href="<?php the_permalink() ?>#respond">
                <?php comments_number('0','1','%'); ?>
                </a></span>
                <?php if ( function_exists('p75GetThumbnail') ) { ?>
                <img src="<?php echo p75GetThumbnail($post->ID, 200, 133); ?>" alt="thumbnail" />
                <?php } ?>
                <span class="date">
                <?php the_time('F jS, Y') ?>
                </span><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
                <?php the_title(); ?>
                </a></h2>
            </div>
            <?php endwhile; ?>
            <div class="navigation">
              <div class="alignleft">
                <?php next_posts_link('&laquo; Older Entries') ?>
              </div>
              <div class="alignright">
                <?php previous_posts_link('Newer Entries &raquo;') ?>
              </div>
            </div>
            <?php else :
    
            if ( is_category() ) { // If this is a category archive
                printf("<h2 class='center'>Sorry, but there aren't any posts in the %s category yet.</h2>", single_cat_title('',false));
            } else if ( is_date() ) { // If this is a date archive
                echo("<h2>Sorry, but there aren't any posts with this date.</h2>");
            } else if ( is_author() ) { // If this is a category archive
                $userdata = get_userdatabylogin(get_query_var('author_name'));
                printf("<h2 class='center'>Sorry, but there aren't any posts by %s yet.</h2>", $userdata->display_name);
            } else {
                echo("<h2 class='center'>No posts found.</h2>");
            }
            get_search_form();
    
        endif;
    ?>
          </div>
        </div>
      </div>
    </div>
    <?php get_footer(); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WordPress Category Template ID breaks thumbnails’ is closed to new replies.