Custom Landing Page Template: Display Categories as Images
-
Hi,
I’m developing my theme with a custom landing page. It’s going well except for one part:
In a nutshell, I want to call a specific category within a div and have it link to the given category page.
In detail:
See screenshot: https://move-onward.com/wp-content/uploads/2011/03/landing-cats.png
:: I have 12 different categories.
:: I want to display a specific thumbnail image for each category of the 12 categories, respectively. The image can be hardcoded and static.
:: When the use clicks the image, he/she opens up a page for that category, which contains all the posts in that category.I’ve tried several methods, such as:
<?php $cat = 7 $args = array( 'orderby' => 'date', 'order' => 'DESC', 'post_type' => 'post', 'numberposts' => 1, 'category__in' => array($cat) ); $posts=get_posts($args); if ($posts) { foreach($posts as $post) { setup_postdata($post); ?> <p><?php the_time('m.d.y') ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p> <?php } } } ?>
but nothing seems to work. I either get a blank page or nothing prints to page in the category block I created.
Finally, my PHP ability sucks. lol.
Any suggestions?
Thank you very much,
DC
- The topic ‘Custom Landing Page Template: Display Categories as Images’ is closed to new replies.