init(); $front = new \bluesquirrel\Front_Settings(); $front->init(); $sf = new \bluesquirrel\Single_Forbid(); $sf->init(); } } catch (Exception $e){ echo $e->getMessage(); } } function bs_theme_admin_area(){ try { if ( current_user_can('edit_themes') && current_user_can('edit_theme_options')) { include_once("inc/main.php"); include_once("inc/customizer.php"); include_once("inc/admin.php"); if ( class_exists( '\bluesquirrel\Admin_Settings' ) ){ $style = new \bluesquirrel\Stylesheets(); $style->init(); $admin = new \bluesquirrel\Admin_Settings(); $admin->init(); } } } catch (Exception $e){ echo $e->getMessage(); } } //Sidebars function bs_init_sidebars(){ if (function_exists('register_sidebar')) { register_sidebar( array( 'name' => __( 'Left Menu', 'blue-squirrel' ), 'id' => 'sidebar-1', 'description' => __( 'Additional sidebar that appears on the left.', 'blue-squirrel' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer', 'blue-squirrel' ), 'id' => 'sidebar-2', 'description' => __( 'Additional sidebar that appears in the footer.', 'blue-squirrel' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } } add_action( 'widgets_init', 'bs_init_sidebars' ); include_once("inc/widget_recent.class.php"); //Recent Posts With Images Widget function bluesquirrel_register_recent_posts_widgets() { register_widget( '\bluesquirrel\Recent_Posts_With_Images_Widget' ); } add_action( 'widgets_init', 'bluesquirrel_register_recent_posts_widgets' ); //Additional Wordpress Features function bs_set_post_thumbnails_and_additional(){ add_theme_support('post-thumbnails'); set_post_thumbnail_size(200, 140, TRUE); add_theme_support( "title-tag" ); add_theme_support( 'custom-header', array( 'header-text' => false ) ); add_theme_support( 'custom-background', array( 'background-color' => false ) ); add_theme_support( 'automatic-feed-links' ); } add_action( 'after_setup_theme', 'bs_set_post_thumbnails_and_additional' ); //Adding editor buttons add_action( 'init', 'bs_infoblock_buttons' ); function bs_infoblock_buttons() { add_filter( "mce_external_plugins", "bs_infoblock_add_buttons" ); add_filter( 'mce_buttons_3', 'bs_infoblock_register_buttons' ); } function bs_infoblock_add_buttons( $plugin_array ) { $plugin_array['infoblock'] = get_template_directory_uri() . '/js/infoblock-plugin.js'; return $plugin_array; } function bs_infoblock_register_buttons( $buttons ) { array_push( $buttons, 'infoblock', 'infoblock2', 'imageblock', 'imageblock2', 'on_hover_transition', 'flipper', 'nummered_list' ); // dropcap', 'recentposts return $buttons; } function bs_change_mce_options( $init ) { $init['extended_valid_elements'] = "a[id,class,style,href,target],div[*]"; return $init; } add_filter('tiny_mce_before_init', 'bs_change_mce_options'); //Main Navigation menu function bs_register_my_menu() { register_nav_menu('header-menu',__( 'Main Menu' , 'blue-squirrel')); register_nav_menu('side-menu',__( 'Right Side (hidden) Menu' , 'blue-squirrel')); } add_action( 'init', 'bs_register_my_menu' ); //Woocommerce support function bs_woocommerce_support() { add_theme_support( 'woocommerce' ); } add_action( 'after_setup_theme', 'bs_woocommerce_support' ); //Enable buttons in editor function bs_enable_more_buttons($buttons) { $buttons[] = 'fontselect'; $buttons[] = 'fontsizeselect'; $buttons[] = 'styleselect'; $buttons[] = 'backcolor'; $buttons[] = 'newdocument'; $buttons[] = 'cut'; $buttons[] = 'copy'; $buttons[] = 'charmap'; $buttons[] = 'hr'; $buttons[] = 'visualaid'; return $buttons; } add_filter("mce_buttons_3", "bs_enable_more_buttons"); function bs_myformatTinyMCE( $in ) { $in['wordpress_adv_hidden'] = FALSE; return $in; } add_filter( 'tiny_mce_before_init', 'bs_myformatTinyMCE' ); //Insert attachments into posts & pages function bs_my_the_content_filter( $content ) { global $post; $hlp = new \bluesquirrel\Helper(); $content = $hlp->insert_all_attachments($post, $content); $content = $hlp->insert_feature_image($post, $content); return $content; } add_filter( 'the_content', 'bs_my_the_content_filter' ); //**********************CREATING CUSTOM TITLE // Custom Page Titles add_action('admin_menu', 'bs_custom_title'); add_action('save_post', 'bs_save_custom_title'); function bs_custom_title() { add_meta_box('custom_title', 'Change page title', 'bs_custom_title_input_function', 'post', 'normal', 'high'); add_meta_box('custom_title', 'Change page title', 'bs_custom_title_input_function', 'page', 'normal', 'high'); } function bs_custom_title_input_function() { global $post; echo ''; echo ''; } function bs_save_custom_title($post_id) { if (isset($_POST['custom_title_input_hidden']) && (!wp_verify_nonce($_POST['custom_title_input_hidden'], 'custom-title-nonce'))) return $post_id; if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return $post_id; if (isset($_POST['custom_title_input'])) { $customTitle = $_POST['custom_title_input']; update_post_meta($post_id, '_custom_title', $customTitle); } } function bs_insert_custom_title($oldtitle) { global $page; $result = ""; if (have_posts()) : the_post(); $customTitle = get_post_meta(get_the_ID(), '_custom_title', true); if ($customTitle) { $result = $customTitle; } else { if (is_tag()) { $result .= single_tag_title(__("Tag Archive for "", "blue-squirrel"), false); $result .= '"'; } elseif (is_archive()) { $result .= $oldtitle; $result .= __(' Archive', "blue-squirrel"); } elseif ((is_single()) || (is_page()) && (!(is_front_page())) ) { $result .= $oldtitle; $result .= ''; } if (is_home()) { $result .= $oldtitle; } else { } } else : $result = __("Page Not Found", "blue-squirrel"); endif; rewind_posts(); return $result; } add_filter('document_title_parts', 'bs_change_wp_title', 20, 1); function bs_change_wp_title($title) { $title['title'] = bs_insert_custom_title($title['title']); return $title; } //******************************************** if ( ! isset( $content_width ) ) $content_width = 1360; ?>