Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-02-02 18:46:47

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 278

how to apply CSS class/style to current article_custom ?

how i can assign the CSS class of current_article just to the article which is open ?


<txp:article_custom category="featured">
    <a class="current_article" href="<txp:permlink />"><txp:title /></a>
</txp:article_custom>

Offline

#2 2018-02-02 20:35:21

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

Re: how to apply CSS class/style to current article_custom ?

You’re supposed to able to use if_this_article without any attribute, like so:

<txp:article_custom category="featured">
    <a<txp:if_article_id> class="current_article"</txp:if_article_id> href="<txp:permlink />"><txp:title /></a>
</txp:article_custom>

but sometimes I can’t get that to work, so I do:

<txp:variable name="this_article"><txp:article_id /></txp:variable>
<txp:article_custom category="featured">
    <a<txp:if_article_id id='<txp:variable name="this_article" />'> class="current_article"</txp:if_article_id> href="<txp:permlink />"><txp:title /></a>
</txp:article_custom>

See if that works…


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB