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' => '
',
'before_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', 'infoblock_buttons' );
function infoblock_buttons() {
add_filter( "mce_external_plugins", "infoblock_add_buttons" );
add_filter( 'mce_buttons_3', 'infoblock_register_buttons' );
}
function infoblock_add_buttons( $plugin_array ) {
$plugin_array['infoblock'] = get_template_directory_uri() . '/js/infoblock-plugin.js';
return $plugin_array;
}
function infoblock_register_buttons( $buttons ) {
array_push( $buttons, 'infoblock', 'infoblock2', 'imageblock', 'imageblock2', 'on_hover_transition', 'flipper', 'nummered_list' ); // dropcap', 'recentposts
return $buttons;
}
function change_mce_options( $init ) {
$init['extended_valid_elements'] = "a[id,class,style,href,target],div[*]";
return $init;
}
add_filter('tiny_mce_before_init', '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' );
//Reformat title
function bs_wpdocs_hack_wp_title_for_home( $title )
{
global $page, $paged;
if ( is_feed() )
return $title;
$site_description = get_bloginfo( 'description' );
$filtered_title = $title . get_bloginfo( 'name' );
$filtered_title .= ( ! empty( $site_description ) && ( is_home() || is_front_page() ) ) ? ' | ' . $site_description: '';
$filtered_title .= ( 2 <= $paged || 2 <= $page ) ? ' | ' . sprintf( __( 'Page %s' , 'blue-squirrel' ), max( $paged, $page ) ) : '';
return $filtered_title;
}
add_filter( 'wp_title', 'bs_wpdocs_hack_wp_title_for_home' );
//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' );
//Support for title output
if ( ! function_exists( '_wp_render_title_tag' ) ) {
function bs_render_title()
{
?>