Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2022-02-13 22:12:48

code365
Member
From: California
Registered: 2009-08-16
Posts: 117

How to get children articles to display

Hi, I am having issues displaying articles from the children category and single articles. I can display the children(s) but when I click on the link to display all the articles followed by the children category link. It doesn’t show the articles. I am not sure what I am doing wrong.

Example:
  • Office (parent)
    • Desk(child)
    • Bookcases(child)
<txp:if_section name='<txp:section/>'>
<txp:if_category>
<!--Display children category -->
<txp:category_list wraptag="div" class="row" break="" parent='<txp:category />' children="1" exclude='<txp:category />'>
 <txp:category title="1" link="1" />
</txp:category_list>
<txp:else />
<txp:if_individual_article>
<!--Display *articles from children category -->
<txp:article category='<txp:category/>' break=""status="live" />

<!--Display *single article from children category -->
<txp:article category='<txp:category/>' break=""status="live" />

</txp:if_individual_article>
</txp:if_category>
</txp:if_section>

Last edited by code365 (2022-02-13 22:50:05)

Offline

#2 2022-02-14 05:36:57

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

Re: How to get children articles to display

You could try

<txp:category_list parent='<txp:category />' exclude='<txp:category />' break="" wraptag="div" class="row">
<txp:category title="1" link="1" />
<txp:article_custom category='<txp:category />' wraptag="ul" limit="999">
<li><txp:permlink><txp:title /></txp:permlink></li>
</txp:article_custom></li>
</txp:category_list>

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

Offline

#3 2022-02-14 06:47:46

code365
Member
From: California
Registered: 2009-08-16
Posts: 117

Re: How to get children articles to display

I apologized if I was unclear. I have a product template page that I will use for all three steps.

  1. I want to show the sub category (ex. Desks, Bookcases etc ) with links. Once the link is clicked.
  2. It will show all the articles for desk.
  3. Once the article has been clicked on, it will display the whole information of the article from the sub category.

Offline

#4 2022-02-14 09:13:00

etc
Developer
Registered: 2010-11-11
Posts: 5,236
Website GitHub

Re: How to get children articles to display

At least two points seem problematic to me:

  • You enclose this block in if_section tag, but the category links do not contain the current section. Clicking such a link hence lands you outside the block, so nothing inside it is displayed. Try using this_section attribute: <txp:category title link this_section />.
  • <txp:article /> tag is called (twice) only in individual article context. Missing <txp:else />, perhaps?

Offline

#5 2022-02-15 05:28:56

code365
Member
From: California
Registered: 2009-08-16
Posts: 117

Re: How to get children articles to display

Thank you.

Offline

Board footer

Powered by FluxBB