WordPress.org

Ready to get started?Download WordPress

Forums

Is there a way to use a page template only once? (2 posts)

  1. hgrianevans
    Member
    Posted 1 year ago #

    In http://wordpress.org/support/topic/passing-rest-of-url-on-as-parameter I talk about getting custom variable into page templates.

    Is there a way that I can make sure a page template is only used once? Let's say I had a political site and had a page template called elections.php

    Using the method in the other link I could use urls like election/2008, election/2012/Virginia etc. But I don't want somebody (myself included) to create another page using the template and the PHP code contained within. That is I don't want to be able to create another page, say myexample, that uses the elections.php template.

    Or is this not a theme issue and my original post should have been looking for ways to pass variables to a page not a template?

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    you could programm a check for the page title into the template, and abort if the page has the wrong title.

Topic Closed

This topic has been closed to new replies.

About this Topic