[wp-trac] [WordPress Trac] #18390: apply_filters for a theme's functions.php

WordPress Trac wp-trac at lists.automattic.com
Sat Aug 13 03:24:55 UTC 2011


#18390: apply_filters for a theme's functions.php
-------------------------+------------------------------
 Reporter:  ofshard      |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Themes       |     Version:  3.2.1
 Severity:  normal       |  Resolution:
 Keywords:               |
-------------------------+------------------------------

Comment (by ofshard):

 Incorporating that, my suggestion would look like this instead:


 {{{
 if ( !defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ){
         $stylesheet_dir = get_stylesheet_directory();
         $template_dir = get_template_directory();

         $path = (file_exists($stylesheet_dir . '/functions.php')) ?
 $stylesheet_dir . '/functions.php' : '';
         $functions = apply_filters('theme_functions', $path);
         if( $functions != '' )
                 include($functions);

         $path = ($template_dir !== $stylesheet_dir &&
 file_exists($template_dir . '/functions.php')) ? $template_dir .
 '/functions.php' : '';
         $functions = apply_filters('theme_parent_functions', $path);
         if( $functions != '' )
                 include($functions);
 }
 }}}

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


More information about the wp-trac mailing list