tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
// This theme uses wp_nav_menu() in two locations.
register_nav_menus (
array(
'primary' => __('Primary Menu', 'blogan'),
)
);
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support('post-thumbnails');
set_post_thumbnail_size( 370, 297, true );
/**
* Add image size use otf_regen_thumbs.php
*/
add_image_size( 'blogan_thumbnail', 400, 400, true ); //featured
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Enable support for Post Formats.
*
* See: https://codex.wordpress.org/Post_Formats
*/
add_theme_support( 'post-formats', array(
'aside',
'image',
'video',
'quote',
'link',
'gallery',
'status',
'audio',
'chat',
) );
/*
* This theme styles the visual editor to resemble the theme style,
* specifically font, colors, icons, and column width.
*/
add_editor_style( 'assets/css/editor-style.css' );
}
endif;
/**
* Content width
*/
function blogan_content_width() {
$GLOBALS['content_width'] = apply_filters( 'blogan_content_width', 900 );
}
add_action( 'after_setup_theme', 'blogan_content_width', 0 );
/**
* Enqueue scripts and styles
*
* @since blogan 1.0
*/
add_action( 'wp_enqueue_scripts', 'blogan_stylesheet' );
function blogan_stylesheet() {
// Google Font
wp_enqueue_style( 'blogan-google-fonts', '//fonts.googleapis.com/css?family=Raleway:700|Open+Sans:400,700', false );
// Bootstrap Stylesheet
wp_enqueue_style( 'blogan-bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css', array(), false, 'all' );
// Font Awesome
wp_enqueue_style( 'blogan-font-awesome', get_template_directory_uri() . '/assets/css/font-awesome.min.css' );
// Theme Stylesheet
wp_enqueue_style( 'blogan-style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'blogan_js');
function blogan_js() {
// Bootstrap js
wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array('jquery'), false, true );
// Dropdown js
wp_enqueue_script( 'dropdown', get_template_directory_uri() . '/assets/js/dropdown.js', array(), false, true);
}
/**
* Excerpt Filter setting
*/
function blogan_excerpt_length($len) {
return 20;
}
add_filter( 'excerpt_length', 'blogan_excerpt_length');
function blogan_excerpt_readmore($more) {
global $post;
return sprintf( '',
get_permalink( get_the_ID() ),
esc_url( get_template_directory_uri() . '/assets/img/readmore.png' )
);
}
add_filter( 'excerpt_more', 'blogan_excerpt_readmore');
if ( ! function_exists( 'blogan_post_format' ) ) :
/**
* Blogan post format
*/
function blogan_post_format() {
if ( ! get_post_format() ) {
echo '';
}
}
endif;
if ( ! function_exists( 'blogan_author' ) ) :
/**
* Blogan Author by
*/
function blogan_author() {
printf( '',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'blogan' ), get_the_author() ) ),
get_the_author()
);
}
endif;
/**
* blogan Time Ago
*/
if ( ! function_exists( 'blogan_time_ago' ) ) :
function blogan_time_ago( $type = 'post' ) {
printf( '%s ' . __('ago', 'blogan') . '', human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ) );
}
endif;
if ( ! function_exists( 'blogan_category' ) ) :
/**
* Blogan Category Post
*/
function blogan_category() {
global $post;
$category_list = get_the_category_list( ' ' );
if ($category_list) {
printf( '%1s', $category_list );
}
}
endif;
if ( ! function_exists( 'blogan_tag' ) ) :
/**
* Blogan tag Post
*/
function blogan_tag() {
global $post;
$tags = wp_get_post_tags($post->ID);
$html = '