The MU forums have moved to WordPress.org

Page Template Hierarchy (4 posts)

  1. nicoliver
    Member
    Posted 14 years ago #

    Hey all,

    Got a bit of a dilemma that I'm trying to work out..

    I'm currently using the Blog Templates plug in by Greg Breese
    http://wpmudevorg.wordpress.com/project/blog-templates/

    My aim is to have a default set of pages that get created with each new blog. These default pages should use specific default templates.

    It was my understanding that using the in-built Wordpress Page Template Hierarchy would do the trick. (i.e if I have a page called 'Recent Updates' with the slug 'recent-updates' and a template file called 'page-recent-updates.php' in the theme folder it would use that as the page template.)

    Sadly, this doesn't seem to be the case and I'm having problems working out the best way forwards.

    I'd appreciate any advice people could give on either modifying this plugin to allow for the option to specify which page template a new page should use OR getting the WPMU page template hierarchy to function correctly.

    Thanks in advance!
    Nic

  2. ronhosner
    Member
    Posted 14 years ago #

    Likely it's not possible or not easy to modify.

  3. granrojo
    Member
    Posted 14 years ago #

    I just included the file within page.php

    Not sure if it's a good way to do it, or if it'll cause other problems later on, but it works.

    global $wp_query;
    
    $slug_page = TEMPLATEPATH . '/page-' . $wp_query->query_vars['pagename'] . '.php';
    
    if(file_exists( $slug_page ) ) {
    
      include( $slug_page );
    
      return;
      }
  4. JackHugh21
    Member
    Posted 14 years ago #

    It worked well for me!

About this Topic

  • Started 14 years ago by nicoliver
  • Latest reply from JackHugh21