[wp-trac] [WordPress Trac] #15803: Page Templates within Plugins

WordPress Trac wp-trac at lists.automattic.com
Sat Jan 22 01:24:20 UTC 2011


#15803: Page Templates within Plugins
-----------------------------+-----------------------------
 Reporter:  sterlo           |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Future Release
Component:  Plugins          |     Version:  3.0.3
 Severity:  normal           |  Resolution:
 Keywords:                   |
-----------------------------+-----------------------------

Comment (by sterlo):

 Elegant solution for the time being:

 Add a rewrite rule...like:

 {{{
 106     function add_rewrite_rule( $existing_rules ) {
 107
 108       $new_rule = array();
 109
 110       $new_rule[ '^(mycustomtaxonomy)' ] =
 'index.php?taxonomy=mycustomtaxonomy';
 111
 112       return $new_rule + $existing_rules;
 113
 114     }
 }}}

 Then add a function call to template_redirect and check to see if the
 taxonomy is set in query_vars.

 If it is, then:

 {{{
 get_header();
 # DISPLAY TEMPLATE HERE
 get_footer();
 exit;
 }}}

 This will cleanly do the work for you until there is something better.

 Make sure to flush the rules so they are rebuilt.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15803#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list