Nishita WordPress Theme – Archive thumbnail
I recently installed the Nishita WordPress theme for a new project I’m working on. The theme is perfect for this project and I’m extremely grateful to the developer, Brajeshwar, for taking the time to create it AND for making it available for free.
The readme was surprisingly difficult to find, but one I did I followed it meticulously and still could not get the thumbnails I created to show up on the Archive page. Instead it was resizing the main image to a 75xwhatever image. Depending on the browser I used this looked somewhere between “acceptable” and “awful”. Besides, I had used the very little bit of creativity I have to make the thumbnails different. I didn’t want all of that work to just go down the drain.
I searched for an answer on the various forums concerning the theme, but came up empty-handed. I’m an ASP guy and all of the code is in PHP. I do have a big PHP project on the horizon though so now was as good a time as any to dig into the code and see if I could fix it. Turns out the solution was fairly simple. I guess too many people were confused with creating and uploading a separate thumbnail so Brajeshwar took a hammer to that part of the process and made the thumbnails automatic. All I had to do was remove his auto-resizing code and put the reference to the excerpt back in.
Most people will be happy with one file upload and auto-resizing for the thumbnails, but for those of you like me who would like to create your own thumbnail, here’s the fix. You’ll need to modify page-archives.php in the theme folder. (I would recommend making a backup of the original first though, just in case. I just opened mine chose, “Save As” and renamed it page-archives.BAK.php.) Find this section in the code:
———————————————————————————-
<div class=”post-body”>
<a href=”<?php the_permalink(); ?>” title=”">
<?php
$pattern = “/\< *[img][^\>]*[src] *= *[\"\']{0,1}([^\"\'\ >]*)/i”;
preg_match_all($pattern, $post->post_content, $images);
if(!$images[1][0]) {?>
<img src=’<?php bloginfo(“template_url”);?>/i/sorry-no-photo.png’ alt=’Sorry! No image was found.’ width=’75px’ />
<?
}
else
echo “<img src=’”.$images[1][0].”‘ width=’75px’ />”;
?></a>
</div>
———————————————————————————-
and change it to:
———————————————————————————-
<div class=”post-body”>
<a href=”<?php the_permalink(); ?>” title=”"><?php the_excerpt(); ?></a>
</div>
<h3><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to ‘<?php the_title(); ?>’”><?php the_title(); ?></a></h3>
<h4><?php the_time(‘F jS, Y’) ?></h4>
</div>
———————————————————————————-
Save it. Upload it to your server in the correct directory and voila! your custom thumbnails now show up.











Leave your response!