TEST TEST

an7_category

iaian7 » code » txp   John Einselen, 4.03.07 (updated 10.04.11)    

The native Textpattern <txp:category1 /> or <txp:category2 /> tags do not allow you to add dependent text. If you use text separators between date, categories, author, and etc., you’re stuck with the separators whether the article has been assigned categories or not.

when categories are assigned, it can look like this:

Article Title – date, category 1, category 2, author

but without categories assigned to the article, separators still show:

Article Title – date, , , author

an7_category allows you to insert the separators as part of the tag; if you assign categories to an article, the categories and separators are inserted, if not, nothing messes up your design!

Tags

There are two tags, just like the Textpattern system:

<txp:an7_category1 />
<txp:an7_category2 />

Plus two options, either set within the plugin or individually for each use of the tag:

before="" – the text prepended to the category link
after="" – the text appended to the category link

The plugin still uses the original Textpattern categories code, and by default the plugin uses <txp:category# link="1" /> to print the names. This can be changed within the plugin. I want to eventually make it more dynamic, but that’s for another version update.

download

1 (version 0.2.1)

installation

Open the textpattern plugin file and copy / paste the text into your Textpattern “install plugin” field (Admin > Plugins). Finish the installation procedure and enable the plugin. That should be it. Use and enjoy!

version history

Please help improve this plugin by reporting errors, issues, or comments via email

v0.2.1
— first public release
— help file finished
v0.2.0
— beta release
— fixed “if” logic
— added the before=”“ option
— hard coded txp:category tag, instead enclosure
v0.1.0 through 0.1.9
— alpha release, nothing worked

help and support

Full instructions and tag options are listed in the Help file within the plugin. The plugin isn’t sophisticated, but it should work well enough, and the setup is minimal.

For questions and support, please visit the an7_category post in the Textpattern Forums.

credits

The tutorials from thresholdstate.com tutorials were helpful as always, and most of my PHP reference was taken from php.net.

bookmark