Doug Stewart avatar Doug Stewart committed c8b6ee2

Moving around the add_action()'s to make them a bit cozier with their targeted functions and correcting some bad options init assumptions.

Comments (0)

Files changed (5)

includes/functions/admin.php

 <?php
 // Set up the admin page &  register settings
 function lblg_add_admin() {
-    $lblg_meta = get_option( 'lblg_meta_info ');
-	$themename = $lblg_meta['themename'];
-    add_theme_page( $themename." Settings", "$themename Settings", 'edit_theme_options', 'lblg_options_page' , 'lblg_admin' );
+	global $lblg_themename;
+    add_theme_page( $lblg_themename." Settings", "$themename Settings", 'edit_theme_options', 'lblg_options_page' , 'lblg_admin' );
 }
+add_action( 'admin_menu', 'lblg_add_admin' );
 
 function lblg_admin_init(){
 	global $lblg_shortname;
 	register_setting( $lblg_shortname . '_theme_options', $lblg_shortname . '_theme_options', 'lblg_sanitize_options' );
 }
+add_action( 'admin_init', 'lblg_admin_init' );
 
 // Display the theme options page
 function lblg_admin() {

includes/functions/hooks.php

 * Elbee Elgee Theme Hooks
 */
 
-$lblg_meta_info = get_option('lblg_meta_info');
-$lblg_options = get_option($lblg_meta_info['shortname'] . "_theme_options" );
-
 /*
 *  Action hooks
 */
 function lblg_enqueue_styles(){
 	do_action( 'lblg_enqueue_styles' );
 }
+add_action( 'wp_print_styles', 'lblg_enqueue_styles', 11 );
 
 /**
 * Output functions.
 	
 	wp_enqueue_style($print_handle,  get_template_directory_uri() . '/print.css', '', '', 'print' );
 }
+add_action( 'lblg_enqueue_styles', 'lblg_styles' );
+
 
 function lblg_credits(){
 	global $lblg_shortname, $lblg_options;
 function lblg_wp_head() { 
 	global $lblg_themename, $lblg_shortname, $lblg_options;
 }
+add_action( 'wp_head', 'lblg_wp_head' );
 
 function lblg_admin_head(){ 
 	global $lblg_themename, $lblg_shortname, $lblg_options;
 }
-
+add_action( 'admin_head','lblg_admin_head' );
 
 // Elbee Elgee action hooks
 add_action( 'lblg_set_themename', 'lblg_themename' );
 add_action( 'lblg_print_menu', 'lblg_menu' );
 add_action( 'lblg_print_copyright', 'lblg_echo_copyright' );
 add_action( 'lblg_print_credits', 'lblg_credits' );
-add_action( 'lblg_enqueue_styles', 'lblg_styles' );
 add_action( 'lblg_print_options', 'lblg_options_walker' );
 
 // WordPress core hooks
-add_action( 'wp_head', 'lblg_wp_head' );
-add_action( 'admin_init', 'lblg_admin_init' );
-add_action( 'admin_head','lblg_admin_head' );
-add_action( 'admin_menu', 'lblg_add_admin' ); 
-add_action( 'wp_print_styles', 'lblg_enqueue_styles', 11 );
-add_action( 'widgets_init', 'lblg_register_sidebars' );
-add_action( 'widgets_init', 'lblg_widgets_init' );
-add_action( 'after_setup_theme','lblg_options_init', 9 );
+
 
 // Only load custom header code if the option is checked
 if( 'true' == $lblg_options['use_custom_header'] ){

includes/functions/options.php

 	$parent_bootstrap = get_theme_data( trailingslashit( TEMPLATEPATH ) . 'style.css' );
 	$child_bootstrap = get_theme_data( trailingslashit( STYLESHEETPATH ) . 'style.css' );
 	
+	print_r($child_bootstrap);
 	/*
 	*  If parent & child are the same theme, these should be equal
 	*
 	*/
 	if( $parent_bootstrap == $child_bootstrap ){
 		$lblg_shortname = $parent_bootstrap['Short Name'];
-		$lblg_themename = $parent_bootstrap['Theme Name'];
+		$lblg_themename = $parent_bootstrap['Name'];
 		$lblg_version = $parent_bootstrap['Version'];
 	} else {
 		$lblg_shortname = $child_bootstrap['Short Name'];
-		$lblg_themename = $child_bootstrap['Theme Name'];
+		$lblg_themename = $child_bootstrap['Name'];
 		$lblg_version = $child_bootstrap['Version'];
 	}
 
+	echo $lblg_themename;
 	// Check to see whether we've been installed previously
 	$lblg_stored_options = get_option( $lblg_shortname . '_theme_options' );
 	
 	$lblg_options['version'] = $lblg_version;
 	update_option( $lblg_shortname . '_theme_options', $lblg_options );
 }
+add_action( 'after_setup_theme','lblg_options_init', 9 );
 
 function lblg_get_options_from_defaults( $default_options ){
 	$stripped_opts = array();

includes/functions/supports.php

 						   'before_title' => '<h4>', 
 						   'after_title' => '</h4>' ) );
 }
+add_action( 'widgets_init', 'lblg_register_sidebars' );
 
 /*
 * Support 2.9, 3.0 and 3.1 coolness

includes/functions/widgets.php

 		register_widget( 'Lblg_BP_Menu_Widget' );
 	}
 	register_widget( 'Lblg_Smart_Recent_Posts_Widget' );
-}
+}
+add_action( 'widgets_init', 'lblg_widgets_init' );
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.