Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-07-26 17:36:30

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

[SOLVED] omit article from article_custom

Is there a way of omitting the current article from an article_custom generated 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

#2 2011-07-26 18:18:40

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

Re: [SOLVED] omit article from article_custom

Maybe I should add what code I am currently using:)

<txp:article_custom label='Other <txp:section />' labeltag="h4" section='<txp:section />' limit="30" wraptag="ul" class="submenu">
<li<txp:if_article_id> class="active"</txp:if_article_id>><txp:permlink><txp:title /></txp:permlink></li>
</txp:article_custom>

I am aware that I can use display:none for the active class but I would rather not.

I like the way related_articles works but as I am not using categories, the tag returns no results.


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 2011-07-26 19:18:03

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [SOLVED] omit article from article_custom

If you don’t mind potentially showing 29 items instead of 30 then, you could just use the if_article_id conditional you already have there, but instead for the class, use it to wrap the whole contents. I.e.

<txp:article_custom>
	<txp:if_article_id>
		<!--
			Yep, it's this one, skip me.
		-->
	<txp:else />
		<!--
			Nope, it ain't, display this one:
		-->
		<li><txp:permlink><txp:title /></txp:permlink></li>
	</txp:if_article_id>
</txp:article_custom>

Offline

#4 2011-07-27 06:29:16

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

Re: [SOLVED] omit article from article_custom

Way to go!. This was much simpler than I thought. Thanks!


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-07-27 07:52:48

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: [SOLVED] omit article from article_custom

Yep, that’s a good example for the documentation of if_article_id and worth a ‘related’ link in article_custom.


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

Board footer

Powered by FluxBB