mdn_if_custom
This plugin provides a number of conditional tests for custom fields. It will check for empty, notempty, equals, or notequals. It also includes an
example usage:
<txp:mdn_if_custom field="2" empty="1">
<else />
Author: <txp:rei_show_custom customid="2" />
</txp:mdn_if_custom>
…where if custom_field2 is empty, it will output nothing, and if custom_field2 is filled, it will print what is after the
Author: Remillard
…
another example:
<txp:mdn_if_custom field="9" equal="author">by <txp:rei_show_custom customid="2" />
<else />
no author listed
</txp:mdn_if_custom>
…where if custom_field9 is filled with the exact text “author”, then it will print
by <em>'name of author'</em>
but if custom_field9 is either empty OR filled with anything other than “author”, it will print
no author listed
Archived [?]: Built-in tag now exists: txp:if_custom_field









You may want to leave your comments/questions at the Forum thread for quicker feedback. Otherwise, comment away:
Commented (3)
why not use Textpattern’s original tag ‘if_custom’..., ?
Actually,
mdn_if_custompredates the built-inif_customtag. There had been no custom-related conditions.. there had not even been a tag to display custom fields.Now, of course there are. Sweet progress.
I still have
mdn_if_custominstalled on all my Textpattern sites. It works as beautifully as it always did, and I can nest in and and out of the ‘new’ built-inif_customtags. The nesting is really useful.Subscribe to this article's comments RSS feed. [ ? ] View Recent Comments across the site.