Use Categories In A Page Template
-
Hello. I’m wondering if anyone can help.
What I want to do is show specific categories ina page template.
For example:<!-- START LOOP --> <?php query_posts('category_name=catname'); ?> <?php if (have_posts()): while (have_posts()) : the_post(); ?> <div class="col-sm-6 col-md-4 contentBlock"> <div class="thumbnail"><?php the_post_thumbnail('featured-image'); ?> <div class="caption"> <h3><?php the_title(); ?></h3> <p><?php the_excerpt(); ?></p> <div id="edit"><?php edit_post_link(); ?></div> </div><!--/CAPTION --> <div class="col-9 btnArrowBlack"><p><a href="#">More</a></p></div> </div><!--/THUMBNAIL --> </div><!--/COL --> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?> <!-- END LOOP -->
And this mixes in with my styles fine.
So I have that in the template and it shows all posts from that category in the page template.What I don’t want to do is have to create a new template and put in the new cat id or slug everytime I want a new page.
I just want to create a page based on one page template and show the categories.
Can anyone help and hopefully this make sense?
Thank you in advance, I will reply.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Use Categories In A Page Template’ is closed to new replies.