Page template with a grid showing post thumbs in a certain category
-
Hi,
Im′m trying to create a new page template for my WP blog. I want it to show all my posts in a certain category, as thumbs in a grid.I would like to have a grid with 8 rows and 4 columns showing the featured images of these posts. And the images should link to the posts. All my featured images are 125x125px so this would be a kind of visual gallery of my posts in that category.
I started with at copy of another page template with full width, as in the code further down. I understand that I need to put the code somewhere close to the loop, but I′m new to PHP and I don′t know how such code should look like. I′ve been reading the WP documentation here for a few nights now and it′s fantastic, but I don′t really get it – yet.
Styling this in the style.css will be no problem, I know html and css but I really need help with the code that selects the posts in a certain category and then presents them in a grid, showing their featured images.
Can I do all this in a page template or do I need some kind of function code in the functions.php and then call it from the page template?
I know there are widgets showing the latest posts with both the excerpt and the post thumb (like this one in the sidebar at https://fthemes.com/demo/Dominate/) so I guess this should be something similar, but I don′t understand how to put it on a page.
I could get the same result using a NextGen gallery on the page, or perhaps find a widget that can be placed on a page, but I would really lika to use PHP code to do this on a page template.
<?php /** * Template Name: Postgrid */ ?> <?php get_header(); ?> <div id="main-fullwidth" class="span-24"> <div class="content"> <?php get_template_part('loop', 'page'); ?> </div><!-- .content --> </div><!-- #main-fullwidth--> <?php get_footer(); ?>
- The topic ‘Page template with a grid showing post thumbs in a certain category’ is closed to new replies.