Forum
Perch Blog - Category Links to Section's Category only
I have three separate news feeds on a site I am building. i.e.:
They share categories types. General, Events, Help & Advice.
The Archive list on the side is working fine by only showing a count for the articles within that section. However when clicking on the Archive links to filter the articles it is showing all the articles from the other Sections also. So even though the count may be "General (3)" the resulting pages shows '6' articles because it's including the artless from other sections.
This is the link in the template:
<li><a href="archive.php?cat=<perch:blog id="categorySlug" />"><perch:blog id="categoryTitle" /> (<perch:blog id="qty" />)</a></li>
<perch:after></ul></li></ul></perch:after>
What would I need to change to make it only show the (3) articles from that section in the resulting page?
You need to pass the section slug through to your archive page, and then filter based on section.
Ok... any documentation on this? I wouldn't know where to start.
To filter any of the blog functions by section add:
to the options. If that slug is on the URL as
section=my-section-slug
you could useThe archive categories links are showing the correct amount of articles on the side. My issue is the side Archive link to the filtered Categories which needs to change?
Clicking the "General News (3)" link takes me to a page showing (5) articles because it's including the posts from other 'Sections' tags with the "General News" category.
This is the URL it shows:
/teachers/news/archive.php?cat=general-news
Yes, you'll need to pass the section slug in the link and then add a filter for the section on any listing you output.
I think it may be because I am not using section.php in my site? I have 3 directories for the three sections each with their own, index,archive, and post pages as follows:
Teachers - index.php - post.php - archive.php
Students - index.php - post.php - archive.php
Parents - index.php - post.php - archive.php
Each index.php filters the posts with:
And the Archive List is filtering with:
How would I "pass the section slug in the link"
perch_blog_categories
andperch_blog_date_archive_years
both use templates that contain links.Pass in the section slug:
and then use it in the links in those templates: