section add_theme_support( 'automatic-feed-links' ); add_action( 'widgets_init', array($this, 'register_sidebars') ); add_theme_support( 'post-thumbnails' ); add_action('wp_enqueue_scripts', array($this, 'load_scripts')); add_action('wp_enqueue_scripts', array($this, 'load_styles')); add_action('wp_head', array($this, 'custom_css')); add_filter('wp_title', array($this, 'doFilterTitle')); } /** * Load the frontend scripts in the header */ function load_scripts(){ wp_register_script(DIFFBLUE_L10N.'_core', get_template_directory_uri().'/js/scripts.js', array('jquery')); wp_enqueue_script(DIFFBLUE_L10N.'_core'); } /** * Load the frontend styles in the header */ function load_styles(){ wp_register_style(DIFFBLUE_L10N.'_bootstrap', get_template_directory_uri().'/css/bootstrap.min.css'); wp_register_style(DIFFBLUE_L10N.'_bootstrap_responsive', get_template_directory_uri().'/css/bootstrap-responsive.min.css'); wp_register_style(DIFFBLUE_L10N.'_style', get_stylesheet_uri()); wp_enqueue_style(array( DIFFBLUE_L10N.'_bootstrap', DIFFBLUE_L10N.'_bootstrap_responsive', DIFFBLUE_L10N.'_style' )); } /** * Display custom CSS in the header if set */ function custom_css(){ $custom_css = stripslashes(get_option(theme_setup_different_blue::$theme_prefix . '_custom_css')); if($custom_css){ echo ''; } } /** * Register the 3 sidebars for this theme */ function register_sidebars(){ // Declare sidebar widget zone register_sidebar(array( 'name' => 'Sidebar Left 1', 'id' => 'sidebar-1', 'description' => 'This theme\'s layout follow this structure (left to right): Sidebar Left 1, Sidebar Left 2, Main Content and the Footer Sidebar below the other three. This is Sidebar Left 1.', 'before_widget' => '
', 'before_title' => '' )); register_sidebar(array( 'name' => 'Sidebar Left 2', 'id' => 'sidebar-2', 'description' => 'This theme\'s layout follow this structure (left to right): Sidebar Left 1, Sidebar Left 2, Main Content and the Footer Sidebar below the other three. This is Sidebar Left 2.', 'before_widget' => '', 'before_title' => '' )); register_sidebar(array( 'name' => 'Footer Sidebar', 'id' => 'sidebar-footer', 'description' => 'This theme\'s layout follow this structure (left to right): Sidebar Left 1, Sidebar Left 2, Main Content and the Footer Sidebar below the other three. This is Footer Sidebar.', 'before_widget' => '', 'before_title' => '' )); } /** * Load the textdomain to be used for this theme for localization */ function localize_init(){ load_theme_textdomain(DIFFBLUE_L10N, get_template_directory() . '/languages'); } // Setup the theme's WordPress admin page function setup_theme_admin_menus() { add_theme_page( $this->adminPageTitle, $this->adminPageShortTitle, 'manage_options', 'different-blue-options', array($this, 'renderAdminPage') ); } function renderAdminPage(){ // Check for permissions if (!current_user_can('manage_options')){ wp_die('You do not have sufficient permissions to access this page.'); exit; } // Save data if the form is submitted if($_POST && is_array($_POST)){ $analytics_code = esc_html($_POST[self::$theme_prefix . '_google_analytics']); $custom_css = esc_textarea($_POST[self::$theme_prefix . '_custom_css']); if($analytics_code) update_option(self::$theme_prefix . '_google_analytics', ($_POST[self::$theme_prefix . '_google_analytics'] )); if($custom_css) update_option(self::$theme_prefix . '_custom_css', addslashes($_POST[self::$theme_prefix . '_custom_css'] )); } ?>'; return $output; } else return $content; } public function doFilterTitle($title){ $siteName = get_bloginfo('name'); if(is_single()){ return get_the_title(). ' | '. $siteName; }elseif(is_category()){ return __("Category", DIFFBLUE_L10N).' "'.get_the_title(). '" | '. $siteName; }else{ return $title; } } } new theme_setup_different_blue(); if ( ! isset( $content_width ) ) $content_width = 900;