WordPress.org

Forums

Widget Logic
Is is_page_template() tag supported? (3 posts)

  1. dashaluna
    Member
    Posted 3 years ago #

    Hello,

    I've got lots of custom rewrite rules and template redirects in the code, which makes most standard WP is_*** conditional tags a bit useless.

    I'm heavily reling on is_page_template() tag. I was wondering if it's supported with widget logic? It doesn't seem to be working at the moment..

    If not, could you give any tips on how to extend it?

    Many thanks,
    Dasha

    http://wordpress.org/extend/plugins/widget-logic/

  2. JochenT
    Member
    Posted 3 years ago #

    Hi,

    As I had problems with get_post_ancestors() I tested is_page_template() and is_page() from within a custom function used with plugin 'Widget Logic', too.
    In the debugging output I could not see any misbehaviour. If it is the standard template is_page_template() fails, otherwise it is true. On the other side is_page() resulted also as true if it was the standard template.

    is_page_template() should only be used outside the loop and may be after calling wp_reset_query().

    Hope this helps.

  3. alanft
    Member
    Plugin Author

    Posted 3 years ago #

    I concur with what JochenT says. is_page and is_page_template work as well as they do in general - i.e. take note of the issue mentioned on

    http://codex.wordpress.org/Function_Reference/is_page_template

    re 'Cannot Be Used Inside The Loop'. so if your sidebar is called AFTER the loop, you might find the 'wp_reset_query' fix helps you out

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic