Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2018-08-26 19:15:55
- BryanA.
- Member
- From: Maryland, USA
- Registered: 2007-08-12
- Posts: 101
Print that Custom2 field after naming it?
I expect this is a breeze – I changed custom2 to episode for a podcast search result purpose. With a special Form, the search results show the date as Month Year published no problem but I’m doing five a week – so I needed to print the episode number without barfing the same number all over the place which is why I hid it in a custom field.
I had:
No. <txp:article_custom><txp:episode /></txp:article_custom> from <txp:posted format=”%b %Y” />
thinking that would do it. It doesn’t.
But I’m close, right?
Voice Actor – starting up a site for that good book stuff.
Offline
Re: Print that Custom2 field after naming it?
Nearly. This is what you want:
No. <txp:article_custom><txp:custom_field name="episode" /></txp:article_custom> from <txp:posted format=”%b %Y” />
TXP Builders – finely-crafted code, design and txp
Offline
Re: Print that Custom2 field after naming it?
Not sure you need to wrap it in article_custom
where it is, since <txp:posted />
seems to work:
<txp:custom_field name="episode" /> from <txp:posted format="%b %Y" />
Offline
#4 2018-08-26 21:47:25
- BryanA.
- Member
- From: Maryland, USA
- Registered: 2007-08-12
- Posts: 101
Re: Print that Custom2 field after naming it?
I suspected there would be quotes involved. Thanks again! It’s a huge help that textpattern makes so many custom fields available. Between that and tags, there’s not much you couldn’t organize in any order you want!
Voice Actor – starting up a site for that good book stuff.
Offline
#5 2018-08-27 00:41:16
- BryanA.
- Member
- From: Maryland, USA
- Registered: 2007-08-12
- Posts: 101
Re: Print that Custom2 field after naming it?
Was typing during etc’s response so saw it much later – interesting is jakob solution printed “252423222120191817” for all articles (podcast) with custom2 and About section was blank accordingly.
etc response was as intended, 25 for one, 24 for another, etc (no pun).
This was a tricky aspect of tru-tags where a page section tag-archives requiring the <txp:if_different> to prevent all tags coming out at once threw a wrench. Somehow or another, unwrapped <txp:custom_field name=“episode” /> was in keeping with this.
My created Form:
<txp:if_different>
<h4 class="archive" style="background: silver;"><txp:tru_tags_current_archive_tag link="1" /></h4>
</txp:if_different>
<div class="archive">
<strong><txp:permlink><txp:title /></txp:permlink></strong>
~ No. <txp:custom_field name="episode" /> from <txp:posted format="%b %Y" />
</div>
Voice Actor – starting up a site for that good book stuff.
Offline