Warning: Invalid argument supplied for foreach() in /home3/digestwp/public_html/wp-content/plugins/wp-twitter-timeline/wp-twitter-timeline.php on line 236

Link Post Thumbnail and Title to Category Page

So I was trying to figure out a way to link the post thumbnails and excerpt title from my home page widgets to go directly to the category pages.

If anyone knows something better let me know. Thanks

<?php 
$category = get_the_category(); 
if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) {
echo '<a href="'.get_category_link($category&#91;0&#93;->term_id ).'"><img src="'.catch_that_image('medium-thumb').'" /></a>';
}
?>   

<?php 
$category = get_the_category(); 
if($category&#91;0&#93;){
echo '<a class="main-headline" href="'.get_category_link($category&#91;0&#93;->term_id ).'">'.get_the_title().'</a>';
}
?>  

Leave a Reply