From b2d4785a7a437e32d21cf24b3f83a4b4c961d9b7 Mon Sep 17 00:00:00 2001 From: greenshady Date: Sat, 16 Oct 2010 12:40:12 +0000 Subject: [PATCH] Move a few actions/filters out of the core Hybrid class into appropriate files. Consolidate the actions and filters methods. git-svn-id: http://svn.locallylost.com/themes/hybrid-core/trunk@408 dba0f204-706d-4bc1-bc29-8b92e0485636 --- functions/media.php | 6 ++++++ hybrid.php | 33 ++++++++------------------------- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/functions/media.php b/functions/media.php index 1357db39..9eaec3d1 100644 --- a/functions/media.php +++ b/functions/media.php @@ -8,6 +8,12 @@ * @subpackage Functions */ +/* Load specific scripts for the framework. */ +add_action( 'template_redirect', 'hybrid_enqueue_script' ); + +/* Load the development stylsheet in script debug mode. */ +add_filter( 'stylesheet_uri', 'hybrid_debug_stylesheet', 10, 2 ); + /** * Function for using a debug stylesheet when developing. To develop with the debug stylesheet, * SCRIPT_DEBUG must be set to 'true' in the 'wp-config.php' file. This will check if a 'style.dev.css' diff --git a/hybrid.php b/hybrid.php index 1a738831..efd5d11a 100644 --- a/hybrid.php +++ b/hybrid.php @@ -81,11 +81,8 @@ function __construct() { /* Language functions and translations setup. */ add_action( 'after_setup_theme', array( &$this, 'locale' ), 3 ); - /* Initialize the framework's default actions. */ - add_action( 'after_setup_theme', array( &$this, 'actions' ), 4 ); - - /* Initialize the framework's default filters. */ - add_action( 'after_setup_theme', array( &$this, 'filters' ), 4 ); + /* Initialize the framework's default actions and filters. */ + add_action( 'after_setup_theme', array( &$this, 'default_filters' ), 4 ); /* Load the framework functions. */ add_action( 'after_setup_theme', array( &$this, 'functions' ), 12 ); @@ -278,29 +275,18 @@ function admin() { } /** - * Adds the default theme actions. + * Adds the default framework actions and filters. * - * @since 0.7.0 + * @since 1.0.0 */ - function actions() { + function default_filters() { - /* Remove WP and plugin functions. */ + /* Move the WordPress generator to a better priority. */ remove_action( 'wp_head', 'wp_generator' ); - - /* Head actions. */ add_action( 'wp_head', 'wp_generator', 1 ); - add_action( 'wp_head', 'hybrid_meta_template', 1 ); - - /* WP print scripts. */ - add_action( 'template_redirect', 'hybrid_enqueue_script' ); - } - /** - * Adds the default theme filters. - * - * @since 0.7.0 - */ - function filters() { + /* Add the theme info to the header (lets theme developers give better support). */ + add_action( 'wp_head', 'hybrid_meta_template', 1 ); /* Filter the textdomain mofile to allow child themes to load the parent theme translation. */ add_filter( 'load_textdomain_mofile', 'hybrid_load_textdomain', 10, 2 ); @@ -308,9 +294,6 @@ function filters() { /* Make text widgets and term descriptions shortcode aware. */ add_filter( 'widget_text', 'do_shortcode' ); add_filter( 'term_description', 'do_shortcode' ); - - /* Stylesheet filters. */ - add_filter( 'stylesheet_uri', 'hybrid_debug_stylesheet', 10, 2 ); } }