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”:http://mt-plugins.org/archives/entry/switch.php with a special keyword, doing this is easy


h3. 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’.
h3. Template code
The template code is quite simple:
bc.

This paragraph is sometimes hidden



h3. 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:
bc.

I am present when the keyword is ShowA


I am present when the keyword is ShowB


I am visible when the keyword is neither ShowA or ShowB



h3. 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.

Comments are closed.