Category posts on specific pages
-
I’m sure that this is possible but I’m unsure as how to make it fully work.
I would like any post that has a specific category to be shown on a specific page, i.e. post “Category A” is displayed on page “A” and post “Category B” displayed on page “B” and so-on.
Also on the main Blog page every post is to be shown with just a summary along with a “Read more” button that takes the viewer to the correct page.
Is there a way of automating this or am I missing something here?
Many thanks
Deryn
Mod
Quote:I would like any post that has a specific category to be shown on a specific page, i.e. post “Category A” is displayed on page “A” and post “Category B” displayed on page “B” and so-on.Use the category archive.
Quote:Also on the main Blog page every post is to be shown with just a summary along with a “Read more” button that takes the viewer to the correct page.In Graphene Display settings, there is an option for this. I’m not on my home computer, but iirc, it’s in “Front Page Options”.
Hi Kenneth
Right, here goes…
From what I’ve been able to glean from looking around I have done this:
1. made a copy of the themes category.php file and named it category-“category-name”.php
2. Added :
<p>Category: <?php single_cat_title(); ?></p>
<?php if ( $paged < 2 ) : ?>
<p>Text for first page of Category archive.</p>
<?php else : ?>
<p>Text for subsequent pages of Category.
Can be left out.</p>
<?php endif; ?>
below the <h1 class="page-title.... section
3. I now need to add a "Loop" to override this section:
/**
* Run the loop for the category page to output the posts.
* If you want to overload this in a child theme then include a file
* called loop-category.php and that will be used instead.
*/
while ( have_posts() ) {
the_post();
get_template_part( 'loop', 'category' );
}Am I on the right road here?????
My questions are now, what form would the loop take to only display posts with specific category slugs using this file and how do I select/add this file to a particular page on the site to display the correct posts?
Or am I completely barking up the wrong tree??
Hope you can help a blatantly obvious amateur here.
Thanks
Deryn
Mod
Yes, you are overthinking this. If you display categories on your site, just click on one to get to that archive. Here is an example:
Hi Kenneth
Sorry for the delay in responding, I’ve been at work all day, but at least it’s now back to doing something that I enjoy, despite the frustration at my lack of knowledge…
I see what you mean about the category selection in the sidebar but that’s not quite what I am trying to achieve.
Each time I create a new post and assign it a category I need that post to be featured on a specific page. If you look at my site you’ll see a page for Resort Guides, each post with the that category needs to be displayed there, or, as an alternative on that page would be a precis of the post with a Read more link just as is currently shown on the main Blog page.
As I have several other pages planned, each to feature only certain posts I would like to know if there is a way to achieve this?
Hope to speak soon
Best wishes
Deryn
Mod
Quote:If you look at my site you’ll see a page for Resort GuidesLink to site?
DezD you need the plug-in “List category posts” once you activate you put a piece of code in your page so it picks up the category posts.
take a look at this page on my site Cheslights.org the lists are formed with the code [catlist name=heritage-maryland+heritage-40_3 orderby=title order=asc numberposts=100]
heritage-maryland+heritage-40_3 are my category names.
I hope this helps!
Hi Cheslights
Spot on, thank you….. This has saved me shed loads of time as well as losing what little hair I have left.
I just need to look further into setting up the CSS for the page in respect of the thumbnail and how to improve the overall look.
Many thanks again.
Deryn
Viewing 10 posts - 1 through 10 (of 10 total)
- You must be logged in to reply to this topic.