. add_theme_support('automatic-feed-links'); // This theme uses wp_nav_menu() in one location. register_nav_menu('primary', __('Primary Menu', 'jc-one-lite')); // Add support for custom backgrounds if ( version_compare( $wp_version, '3.4', '>=' ) ) add_theme_support( 'custom-background' ); else add_custom_background(); // Add support for custom headers if ( version_compare( $wp_version, '3.4', '>=' ) ) add_theme_support( 'custom-header' ); else add_custom_image_header(); // Add support for Featured Images add_theme_support('post-thumbnails'); set_post_thumbnail_size(200, 100, true); add_image_size('large-feature', 500, 375, true); // Used for large feature (header) images add_image_size('small-feature', 800, 200, true); // Used for small feature (header) images // set the good content width if (jc_get_option('sidebar') != 'no'){ global $content_width; $content_width = 560; } // Add Shortcodes if (jc_get_option('sc') != 'no'){ require_once(get_template_directory().'/include/shortcode.php'); // Enable Shortcodes in excerpts and widgets add_filter('widget_text', 'do_shortcode'); add_filter('the_excerpt', 'do_shortcode'); add_filter('get_the_excerpt', 'do_shortcode'); } if (jc_get_option('sc_wpauto') == 'no'){ remove_filter('the_content', 'wpautop'); remove_filter('the_content', 'wptexturize'); } else { remove_filter('the_content', 'wpautop'); remove_filter('the_content', 'wptexturize'); add_filter('the_content', 'jc_sc_wpautop', 99); add_filter('widget_text', 'jc_sc_wpautop', 99); add_filter('the_excerpt', 'jc_sc_wpautop', 99); add_filter('get_the_excerpt', 'jc_sc_wpautop', 99); } if (is_admin()){ add_action('init', 'jc_init_theme_options'); add_action('admin_menu', 'jc_theme_menu'); add_action('admin_menu', 'jc_admin_load'); add_action('admin_menu', 'jc_admin_resources'); if (is_admin() && isset($_GET['activated'])) { jc_init_default_themes_options(true); } } else { add_action('wp_enqueue_scripts', 'jc_load_js'); add_action('wp_head', 'jc_wp_head'); add_action('wp_footer', 'jc_wp_footer'); } // Under Construction Feature global $pagenow; if (!(is_admin() || $pagenow == 'wp-login.php')){ if (!is_user_logged_in()) { if (jc_get_option('under_contruction') == 'yes'){ add_action('template_redirect', jc_under_contruction()); } } } } } // jc_one_setup function jc_load_options() { global $jc_options; if (count($jc_options) == 0){ // load theme options $jc_options = get_option('jc_theme_options', false); if (!is_array($jc_options) || (is_array($jc_options) && count($jc_options) == 0)) { jc_init_default_themes_options(); } } } function jc_get_option($key, $default=false) { global $jc_options; $ret = $default; if (is_array($jc_options) && array_key_exists($key, $jc_options)){ $ret = $jc_options[$key]; } return $ret; } function jc_add_option($key, $value) { return jc_update_option($key, $value); } function jc_update_option($key, $value) { global $jc_options; if (is_array($jc_options)){ $jc_options[$key] = $value; return true; } return false; } function jc_delete_option($key) { global $jc_options; if (is_array($jc_options) && array_key_exists($key, $jc_options)){ unset($jc_options[$key]); return true; } return false; } function jc_sc_wpautop($content) { $new_content = ''; $pattern_full = '{(\[raw\].*?\[/raw\])}is'; $pattern_contents = '{\[raw\](.*?)\[/raw\]}is'; $pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE); foreach ($pieces as $piece) { if (preg_match($pattern_contents, $piece, $matches)) { $new_content .= $matches[1]; } else { $new_content .= wptexturize(wpautop($piece)); } } return $new_content; } /** * Add Static Javascript And CSS Library */ function jc_load_js(){ // Enqueue Javascript if(!is_admin()) { wp_enqueue_script('jquery'); if (file_exists(get_template_directory()."/js/libs/modernizr-2.0.6.min.js")) { wp_enqueue_script('jc-one-modernizr', get_template_directory_uri() . '/js/libs/modernizr-2.0.6.min.js', array('jquery')); } if (file_exists(get_template_directory()."/js/plugins.js")) { wp_enqueue_script('jc-one-plugins', get_template_directory_uri() . '/js/plugins.js', array('jquery', 'jc-one-modernizr')); } if (file_exists(get_template_directory()."/js/script.js")) { wp_enqueue_script('jc-one-script', get_template_directory_uri() . '/js/script.js', array('jquery', 'jc-one-modernizr')); } if (file_exists(get_template_directory()."/styles/".jc_get_option('stylesheet'))) { wp_enqueue_style('jc-one-custom-style', get_template_directory_uri()."/styles/".jc_get_option('stylesheet')); } } } /** * Add Custom Javascript And CSS in head */ function jc_wp_head(){ $css = jc_get_option('css'); $js = jc_get_option('js'); $out = ''; if ($css != '') $out .= ''."\n"; if ($js != '') $out .= '\n"; echo $out; } /** * Add Custom Javascript in footer */ function jc_wp_footer(){ ?> __('Main Sidebar', 'jc-one-lite'), 'id' => 'primary', 'before_widget' => '", 'before_title' => '
', ''); ?>