tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
add_image_size('blog_star_featured_img',621,272,true);
add_image_size('blog_star_main_img',295,301,true);
add_image_size('blog_star_blog_img',147,125,true);
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'blog-star' ),
) );
/*
* custom logo
*/
add_theme_support( 'custom-logo', array(
'height' => 32,
'width' => 158,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'gallery',
'caption',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'blog_star_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
}
endif;
add_action( 'after_setup_theme', 'blog_star_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function blog_star_content_width() {
$GLOBALS['content_width'] = apply_filters( 'blog_star_content_width', 640 );
}
add_action( 'after_setup_theme', 'blog_star_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function blog_star_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'blog-star' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'blog-star' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Single page sidebar', 'blog-star' ),
'id' => 'blog-star-sinlge-sidebar',
'description' => esc_html__( 'Add widgets here for displaying sidebar in Single page.', 'blog-star' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'blog_star_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function blog_star_scripts() {
wp_enqueue_style( 'bootstrap-min', get_template_directory_uri().'/css/bootstrap.min.css', array(),'3.3.6','all');
wp_enqueue_style( 'font-awesome', get_template_directory_uri().'/css/font-awesome.css', array(),'4.6.3','all');
wp_enqueue_style( 'blog-star-style', get_template_directory_uri().'/css/style.css', array(),'','all');
wp_enqueue_style( 'blog-star-main-style', get_stylesheet_uri(), array(),'','all' );
wp_enqueue_style( 'yanone-kaffeesatz',"http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:400,200,300,700");
wp_enqueue_style( 'blog-star-media', get_template_directory_uri().'/css/media.css', array(),'','all');
if ( ! is_admin() ) {
wp_enqueue_script( 'jquery' );
}
wp_enqueue_script( 'bootstrap-min-js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '3.3.6', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'blog_star_scripts' );
// include customizer css file
function blog_star_customizer_css(){
wp_register_style('blog-star-customizer', get_template_directory_uri() . '/css/blog_star_customizer.css', false, '1.0.0' );
wp_enqueue_style('blog-star-customizer');
}
add_action('admin_enqueue_scripts','blog_star_customizer_css');
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load the customize pro file
*/
require_once( trailingslashit( get_template_directory() ) . 'blog-star-customize-pro/class-customize.php' );
/**
* Setting excerpt length
*/
function blog_star_custom_excerpt_length( $length ) {
return 25;
}
add_filter( 'excerpt_length', 'blog_star_custom_excerpt_length', 999 );
function blog_star_new_excerpt_more( $more ) {
return '…';
}
add_filter('excerpt_more', 'blog_star_new_excerpt_more');
/**
* Include the TGM_Plugin_Activation class.
*/
add_action( 'tgmpa_register', 'blog_star_register_required_plugins' );
/**
* Register the required plugins for this theme.
*
*
*
* This function is hooked into tgmpa_init, which is fired within the
* TGM_Plugin_Activation class constructor.
*/
function blog_star_register_required_plugins() {
/*
* Array of plugin arrays. Required keys are name and slug.
* If the source is NOT from the .org repo, then source is also required.
*/
$plugins = array(
array(
'name' => __('Contact Form 7','blog-star'),
'slug' => 'contact-form-7',
'required' => false,
),
array(
'name' => __('WordPress Importer','blog-star'),
'slug' => 'wordpress-importer',
'required' => false,
),
array(
'name' => __('Widget Importer & Exporter','blog-star'),
'slug' => 'widget-importer-exporter',
'required' => false,
),
array(
'name' => __('Social Icons','blog-star'),
'slug' => 'social-icons',
'required' => false,
),
);
/*
* Array of configuration settings. Amend each line as needed.
*
* TGMPA will start providing localized text strings soon. If you already have translations of our standard
* strings available, please help us make TGMPA even better by giving us access to these translations or by
* sending in a pull-request with .po file(s) with the translations.
*
* Only uncomment the strings in the config array if you want to customize the strings.
*/
$config = array(
'id' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to bundled plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'parent_slug' => 'themes.php', // Parent menu slug.
'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used.
'has_notices' => true, // Show admin notices or not.
'dismissable' => true, // If false, a user cannot dismiss the nag message.
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
);
tgmpa( $plugins, $config );
}
// CUSTOMIZING COMMMENT FORM
function blog_star_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
?>
'.get_avatar( $comment, $args['avatar_size'] ).''; ?>
__( 'Reply', 'blog-star' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>