Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-04-13 05:03:17

ibadullah
New Member
From: Kabul, Afghanistan
Registered: 2017-09-16
Posts: 24

two category in same section

Hello!
how can i add two category in same section? or how to add two category in one section?


<div class="featured">
        <txp:article_custom category="update" section="dari" limit="3" offset="1">
        <txp:article_image thumbnail="1" />
        <a href="<txp:permlink />"><h5 class="paragraph"><txp:title /> </h5>
            <h3> <txp:excerpt /></h3></a> 
         </txp:article_custom>
      </div>

As i have already a category in the above code, i need another category as well in this section. i mean in same time two category in same section.

Offline

#2 2019-04-13 06:18:53

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,245
Website

Re: two category in same section

Is this what you need?

<txp:article_custom category="update,other_category" section="dari" limit="3" offset="1">
<txp:article_image thumbnail="1" />
<a href="<txp:permlink />"><h5 class="paragraph"><txp:title /> </h5>
<h3> <txp:excerpt /></h3></a> 
</txp:article_custom>

Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

#3 2019-04-13 06:45:44

ibadullah
New Member
From: Kabul, Afghanistan
Registered: 2017-09-16
Posts: 24

Re: two category in same section

Hi colak
does two category work in same time?
i have tried it but not working plz guide me

when i chose one of the these category it should show me the article of the that category.
or if there is another way to defined the two category in the same section.

Last edited by ibadullah (2019-04-13 10:02:41)

Offline

#4 2019-04-13 12:04:07

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,435
Website

Re: two category in same section

The docs for article_custom say that a comma-separated list of categories should be possible.

Try first making limit a larger value. You are only looking for three articles and the standard sort order is by date, so if all your most recent articles (except for the first one, as you have offset set) are in the same category, you might not notice that it is working correctly. Or use sort="rand()" to get random results each time.

You can also use txp:category_list to produce two article_custom outputs, but they are then one after the other.


TXP Builders – finely-crafted code, design and txp

Offline

#5 2019-04-13 17:35:06

ibadullah
New Member
From: Kabul, Afghanistan
Registered: 2017-09-16
Posts: 24

Re: two category in same section

the comma-separated working in <txp:if_category name="photos, video">
but its not working in <txp:article_custom category when we want to add two different category.
is there another way to defined two category in same section in <txp:article_custom category ?

Offline

#6 2019-04-13 17:42:34

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,245
Website

Re: two category in same section

Hi ibadullah,

Are you sure you have enough articles in the other category which are newer than the ones you have as a limit?


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

Board footer

Powered by FluxBB