Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2024-11-07 18:39:31

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

Re: Match article with categories

@Jakob – the articles are getting pulling from coaching categories and the title Other Services is a h2 tag. Yes, I only want the relevant articles(s) to show with each service. Should I make the main article sticky?

@Bloke – Hope the information below can be of help in regard to how the page is built.

Really, thank you guys and everyone support in this forum.

 <!-- This is the page template code  -->

<txp:if_individual_article>
<txp:article limit="1" form="main"/>
</txp:if_individual_article>
<hr>
<txp:article_custom  section="coaching" exclude='<txp:category />' form="body" category='b2' wraptag="" limit="1"/>

 <!-- This is the page template code  -->

<txp:images limit="1" escape="">
<figure>
<txp:image class="img-fluid" escape="trim"/>
</figure>
</txp:images>

<txp:category_list label="" labeltag="" parent='coaching' exclude='<txp:category />' break="" wraptag="" class="">
<txp:article_custom category='<txp:category />' wraptag="" class="" limit="999">
<a href="<txp:permlink/>"><txp:title /></a>
</txp:article_custom>
</txp:category_list>

 <!-- This is the page template code  -->


 <txp:related_articles limit="99">
 <txp:body/>
 </txp:related_articles>

Last edited by code365 (2024-11-07 18:47:56)

Offline

#14 2024-11-08 11:08:58

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

Re: Match article with categories

Creating a (first) category per service and making ‘main’ articles sticky looks like the most natural solution, indeed. Assuming you’ve done it, the following blocks should work in an individual article context:

 <!-- Other services  -->

<txp:article_custom id exclude="id" section status="sticky" sort="Category1" limit="999">
    <a href="<txp:permlink/>"><txp:title /></a>
</txp:article_custom>

 <!-- Related articles  -->

 <txp:related_articles match="section, category1" limit="99">
     <txp:body/>
 </txp:related_articles>

Offline

Board footer

Powered by FluxBB