This is a test page for a customized template for projects. If the URL for the page includes a topic parameter, the template will display resources associated with that topic, where the topic parameter is the slug of a category (e.g. plastic-bag-ban).

The idea is that we can create project pages which will be consistent and will show resources for the project after the unique content for the project. The page is simply called with the parameter (e.g. /blog/MyProject/?topic=RTS-solar)

This is currently implemented by creating a custom page template in the child theme (projectpage.php) which can be selected from the attributes section of the page. The custom code is in the customized template-part file projectcontent-page.php. The page template calls projectcontent-page.php when display the content portion of a page.

To-Do:

  • Now that the call to the shortcodes is in the template, could I instead convert the page’s name to the necessary category name?
  • In that way, any page created with the projectpage.php page template could show its custom content without needing a parameter in the url.
  • Perhaps we can using an existing WP global from the page name and translate it to a category? Or have the page associated with a category and get that directly as an attribute of the page? Other pages in the same category will not be affected as long as they don’t use the custom page template.

Notes:

  • Execution of PHP code in posts and pages is not allowed. (security vulnerability to cross-site-scripting) There are plugins to accomplish this.
  • This would be the most general solution, but it would require PHP code in the pages, and is more complex.
  • Accessing the URL string variables through a plugin for that specific purpose should be easier and cleaner.

Upcoming Events