Textpattern tips, tutorials and code snippets

Creating unlimited categories

Despite all its great features, Textpattern doesn’t seem to handle categories very well in a core installation, for example each article can only be assigned two categories.

After spending considerable time in the textpattern forum, I finally figured out how to create unlimited categories in Textpattern. I have put together the guide to prevent heartache for other newbies like me ;)

Please note that the guide is based on a default Textpattern installation.

Step by step guide to adding unlimited categories

  1. Install the rss_unlimited_categories plugin and enable it. The plugin should automatically create a new sql table called textpattern_category.

Create a new section called category and use the default page template

In the default page, replace the code:

<txp:if_category>
<h2><txp:category title="1" /></h2>
<div class="hfeed">
<txp:article form="article_listing" limit="5" />
</div>

With this code:

<txp:if_category>
<h2>Category: "<txp:category title="1" />" </h2>
<div class="hfeed">
<txp:rss_uc_article_list section="articles"
form="default" />
</div>

In the default form, replace the code:

<p class="tags">
<txp:category1 title="1" link="1" />,
<txp:category2 title="1" link="1" />
</p>

With this code:

<p class="tags">Tags:
<txp:rss_uc_filedunder section="articles"
linktosection="category" />
</p>

To be able to show categories in the sidebar, some modification is also required. Simply replace the code below:

<txp:category_list sort="name asc"
type="article" wraptag="ul" break="li"/>

With this code:

<txp:rss_uc_list linktosection="category"
showcount="1" wraptag="ul"
break="li" class="category_list" />

Other tweaks

It may also be useful to hide the old category form, use the ied_hide_in_admin plugin to do this.

Enlarging the the text area for the new category form can be done in SQL. I only recommend this if you are comfortable with SQL.

  1. Go into your SQL database
  2. Browse “txp_pref”
  3. Find “rss_unlim_sel_size”
  4. Change the “val” of “rss_unlim_sel_size” to 15

All things being equal, that’s all you need to do!

Useful links

Getting Started with Textpattern (here you can find the default page and form templates)
rss_unlimited_categories Support forum

3 Comments Comment feed

You can use my patched version of this plugin. It fixes some bugs.

More info: https://textpattern.org.ua/patches/rss_unlimited_categories

So, you have adapted categories as tags? Not a good idea, I think. Category1/category2 are taxonomy classes for hierarchical structure of human knowledge and activity, e.g. for chapters of reference book. There are keywords for free and unlimited tags, as are in Technorati and Delicious. It would be fine to make also TxP tag for <a rel="tag"> by default, beside of <txp:meta_keywords />.

I disagree with Vienuolis but only because Google loves multiple tags and using those in anchor text. We need this plugin to compete with WP.

Add a comment

Use Textile help to style your comments