Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2023-10-02 00:46:09

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,099
Website Mastodon

Collect posts based on a category into a Section

Thought I should ask before I procceed to ensure I am on the right track and this is the proper TxP way.
I would like to have a Section eg, called Races. And any posts that I add to my default “blog” entry which appear on the default from page, I would like to also have them collected in a specific order into the section Races., based on a category that I assign such posts. So a subset of blog posts filtered into the Races section based on Category. Thoughts? suggested code?


…. texted postive

Offline

#2 2023-10-02 08:37:33

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,540
Website GitHub Twitter

Re: Collect posts based on a category into a Section

Hi

If Blog article are assigned to Races section using txp:article in Racces url will pull them all, if the blog artticles are assigned to another section you need to use txp:article_custom to pull them.

Cheers.

Offline

#3 2023-10-02 21:12:05

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,752
Website

Re: Collect posts based on a category into a Section

Dragondz wrote #335771:

if the blog articles are assigned to another section you need to use txp:article_custom to pull them.

Yup, so if your articles are assigned to the “blog” section and the relevant posts to the “races” category, you’d use a tag something like this in your page template for the races section, to show just the relevant blog articles:

<!-- this code goes on the "races" section page template -->
<txp:article_custom section="blog" category="races" />

adding any further attributes you may need to denote the form to use, how many to show etc.


TXP Builders – finely-crafted code, design and txp

Offline

#4 2023-10-04 06:29:19

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,099
Website Mastodon

Re: Collect posts based on a category into a Section

jakob wrote #335775:

Yup, so if your articles are assigned to the “blog” section and the relevant posts to the “races” category, you’d use a tag something like this in your page template for the races section, to show just the relevant blog articles:

<!-- this code goes on the "races" section page template -->...

adding any further attributes you may need to denote the form to use, how many to show etc.

thanks. i need to use this as what i ended up doing was not as elegant as i had “imagined’ doing. I went with a separate section. so back to the drawing board.

edited: PS I didn’t receive an email notifying me that this was posted.

Last edited by bici (2023-10-04 06:36:43)


…. texted postive

Offline

Board footer

Powered by FluxBB