Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page template tests don't recognise default templates #305

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

richplane
Copy link

The hide_on and show_on settings wouldn't recognise "front-page.php" and "home.php" as page-template values, because the wp_postmeta just has these as 'default'.

So I've altered the two functions show_for_page_template and hide_for_page_tempate(), which perform the test against the given template slugs. In the case where the postmeta shows "default" they now test the current post against the front page and posts page from the site options.

add_for_page_template() and hide_for_page_template() will now detect the use of "front-page.php" and "home.php" templates.
@richplane
Copy link
Author

If anyone else was waiting for this, here's a workaround: use

array(
    'show_on' => array(
        'id' => get_option('page_on_front')
    ),
    ....

...and 'page_for_posts' works for home.php.

@mikeselander mikeselander changed the base branch from master to develop November 11, 2016 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants