Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Testing if this is NOT a category listing (See related posts)

The new releases of textpattern tend to use the new "yoursite.com/category/ZZZ" url format for category listing links. Which means that those category-filtered archives use the "default" template for formatting & so forth.

To handle this on the front page, you need to be able to test if the current view IS a category search, and you also need to test if this ISN't a category search (to display normal front-page content). To do this I had to modify the glx_if plugin - very easy really.

In Textpattern, go to admin > plugins, and click the "edit" link for glx_if. Add the following function anywhere it would seem to fit:

function glx_if_not_category_list($atts, $thing)
{
        global $pretext, $is_article_list;
        return (empty($pretext["c"]) && $is_article_list == true) ? parse($thing) : "";
}


A use for this is shown in this snippet.


You need to create an account or log in to post comments to this site.


Related Posts