Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-10-25 07:43:25

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

List of articles from a group of categories (->parent category)

Can I list articles from a certain ‘parent category’ (list of articles from a group of categories)?

————————————
All this occurs because I previously dind’t use the right name for the article sections, so that they can’t match the name of the ‘section’ of the page in which now I need to list them.
————————————
TNX

Last edited by Bongo-man (2011-10-25 07:44:02)

Offline

#2 2011-10-25 18:06:39

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: List of articles from a group of categories (->parent category)

Bongo-man wrote:

Can I list articles from a certain ‘parent category’ (list of articles from a group of categories)?

<txp:article_custom category='<txp:category_list parent="your-parent-category" exclude="your-parent-category" break=","><txp:category /></txp:category_list>' />

All this occurs because I previously dind’t use the right name for the article sections, so that they can’t match the name of the ‘section’ of the page in which now I need to list them.

It is possible to change category and section names, even if they already have articles. Though if your site is indexed well by search engines, this might not be so wise.

Offline

#3 2011-10-26 05:44:41

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Re: List of articles from a group of categories (->parent category)

Els wrote:

Bongo-man wrote:

Can I list articles from a certain ‘parent category’ (list of articles from a group of categories)?

<txp:article_custom category='<txp:category_list parent="your-parent-category" exclude="your-parent-category" break=","><txp:category /></txp:category_list>' />

Thanks, but what I need is the contrary: I need only articles from my parent category.

Els wrote:

All this occurs because I previously dind’t use the right name for the article sections, so that they can’t match the name of the ‘section’ of the page in which now I need to list them.

It is possible to change category and section names, even if they already have articles. Though if your site is indexed well by search engines, this might not be so wise.

All that is true in my blog.

Last edited by Bongo-man (2011-10-26 05:45:45)

Offline

#4 2011-10-26 07:42:50

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,172
Website GitHub Mastodon Twitter

Re: List of articles from a group of categories (->parent category)

It is possible to change category and section names, even if they already have articles. Though if your site is indexed well by search engines, this might not be so wise.

You can still do it using some htaccess redirect magic.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2011-10-26 08:36:20

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

Re: List of articles from a group of categories (->parent category)

Thanks, but what I need is the contrary: I need only articles from my parent category

Does simply putting the parent category in the category attribute not work? e.g.

<txp:article_custom category="your-parent-category"> ... </txp:article_custom>

If you want articles from your parent category and its children, use Els’ code but without the exclude attribute.


TXP Builders – finely-crafted code, design and txp

Offline

#6 2011-10-26 18:36:08

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Re: List of articles from a group of categories (->parent category)

Thank you, really it would be ok, but I explained all this not the just way. I have got some parent categories in my web-site and I need articles from the ‘actual’ parent category.

Then what I really need is something like this:

<txp:article_custom category=“parent”> … </txp:article_custom>

But I think there is no solution!?
Anyway, I thank you.

Offline

#7 2011-10-26 19:17:19

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: List of articles from a group of categories (->parent category)

Ah, you need to find the parent category of the current child category? I remember seeing a solution for that. Somewhere. I’ll try and find it.

Edit: found it, smd_parent.

Last edited by els (2011-10-26 19:20:03)

Offline

#8 2011-10-28 07:42:34

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Re: List of articles from a group of categories (->parent category)

Thanks Els, thank you all very much for this amount of useful informations, but I have some little problem more, I think I will open an other post.
Thanks again

Offline

#9 2012-06-28 17:55:20

totoff
Member
From: Cologne, Germany
Registered: 2011-04-04
Posts: 145
Website

Re: List of articles from a group of categories (->parent category)

hello forum,

i had a similar question and got it answered thanks to els. but, as i’m not very familiar with <txp:if_different>, does anybody know how to output the resulting list grouped by parent categories?

currently i’m using this code from els:

<txp:article_custom category='<txp:category_list parent="your-parent-category" exclude="your-parent-category" break=","><txp:category /></txp:category_list>' />

thanks, christoph

Last edited by totoff (2012-06-28 17:56:12)

Offline

Board footer

Powered by FluxBB