Hiding content in Individual Entries
There are certain individual entries in this blog from which I need to selectively hide parts of the otherwise static page content. Combining my Switch Plugin with a special keyword, doing this is easy
Keywords
This method of hiding content works on the premise that you use exactly one keyword for entries where you need to hide certain content.
The “Keywords” facility in MT (2.x) can be made visible by clicking “Customize the display of this page.”, where you need to create a custom display of the entries page.
For my example, I’m using the keyword ‘noshow’.
Template code
The template code is quite simple:
<MTSwitch value="[MTEntryKeywords]">
<MTSwCase value="noshow"></MTSwCase>
<MTSwDefault>
<p>This paragraph is sometimes hidden</p>
</MTSwDefault>
</MTSwCase>
Other way round?
You can of course use this plugin the other way around, only showing static content dependent on the presence of a keyword:
<MTSwitch value="[MTEntryKeywords]">
<MTSwCase value="ShowA">
<p>I am present when the keyword is ShowA</p></MTSwCase>
<MTSwCase value="ShowB">
<p>I am present when the keyword is ShowB</p></MTSwCase>
<MTSwDefault>
<p>I am visible when the keyword is neither ShowA or ShowB</p>
</MTSwDefault>
</MTSwCase>
Caveat
The Switch plugin requires an exact string match, so “noshow”, or whatever other keyword you choose must be the only keyword present for the entries where you want to show/hide static content.
This discussion has been closed. No further comments may be added.