soo_if_frontpage

Summary:

Check if current page is a section front page

soo_if_frontpage version 0.1.9, 0.6 KB
(If it won’t install try the compressed version)

Source files and archived releases available on GitHub.

As usual there’s a discussion thread on the Textpattern forum.

Full plugin help text

Courtesy soo_plugin_display


soo_if_frontpage

This is a plugin for Textpattern.

Contents

Overview

Similar to the glx_if_frontpage tag from the no-longer-supported “ glx_if plugin. Most of that functionality is now available through core Txp tags, but not this (well, not without an absurd stack of conditional tags).

Usage

<txp:soo_if_frontpage>
...
<txp:else />
...
</txp:soo_if_frontpage>

soo_if_frontpage evaluates to true if the current page context is:

Attributes

None required.

Examples

Most restrictive case

<txp:soo_if_frontpage pg="1">
... Home page ONLY
<txp:else />
... any other page
</txp:soo_if_frontpage>

The above example returns true for the home page only. E.g., http://example.com/ will cause the tag to return true, but any other standard Txp URL will return false.

Least restrictive case

<txp:soo_if_frontpage section="*">
... Home page, section front page, plus subsequent pages of a paginated list
<txp:else />
... Indivdiual article; individual image; category, author, date, or search result lists
</txp:soo_if_frontpage>

The above example returns true on the home page, any section front page, and any paginated variation thereof. E.g., these pages would all return true:

Version History

0.1.9 (2017/02/13)

Txp 4.6 compatibility update

0.1.8 (1/14/2011)

Added check for global image context (i.e., the p query parameter)

0.1.7 (1/4/2011)

Documentation updated with descriptive examples. (Thanks to Andre D for the suggestion.)

0.1.6 (10/7/2010)

More code cleaning, after I remembered that $pretext is already extracted in global scope

0.1.5 (10/7/2010)

Documentation update, code cleaning

0.1.4 (10/6/2010)

New feature: section="*" is a shortcut for specifying all sections (including the default section)

0.1.3 (6/22/2010)

Fixed bug: section front pages now treated correctly (thanks, Victor)

0.1.2 (7/2009)

Added author and month search to the conditions to check against

0.1.1 (7/2009)

Added pg attribute; code and documentation cleaning; updated plugin template

0.1 (1/2008)

soo_if_frontpage tag with section attribute

Posted 2009-07-08 (last modified 2017-03-13)