urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( 'latin,latin-ext' ),
);
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
}
return $fonts_url;
}
endif;
/*----------------------------------------------------------------------------------------------------------------*/
/**
* Enqueue scripts and styles.
*/
function editorial_scripts() {
global $editorial_version;
wp_enqueue_style( 'font-awesome', get_template_directory_uri().'/assets/library/font-awesome/css/font-awesome.min.css', array(), '4.7.0' );
wp_enqueue_style( 'editorial-google-font', editorial_fonts_url(), array(), null );
wp_enqueue_style( 'editorial-style', get_stylesheet_uri(), array(), esc_attr( $editorial_version ) );
wp_enqueue_style( 'editorial-responsive', get_template_directory_uri().'/assets/css/editorial-responsive.css', array(), esc_attr( $editorial_version ) );
wp_enqueue_script( 'jquery-bxslider', get_template_directory_uri() . '/assets/library/bxslider/jquery.bxslider.min.js', array( 'jquery' ), '4.2.12', true );
$menu_sticky_option = get_theme_mod( 'editorial_sticky_option', 'enable' );
if ( $menu_sticky_option != 'disable' ) {
wp_enqueue_script( 'jquery-sticky', get_template_directory_uri(). '/assets/library/sticky/jquery.sticky.js', array( 'jquery' ), '20150416', true );
wp_enqueue_script( 'editorial-sticky-menu-setting', get_template_directory_uri(). '/assets/library/sticky/sticky-setting.js', array( 'jquery-sticky' ), '20150309', true );
}
wp_enqueue_script( 'editorial-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array(), esc_attr( $editorial_version ), true );
wp_enqueue_script( 'editorial-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), esc_attr( $editorial_version ), true );
wp_enqueue_script( 'editorial-custom-script', get_template_directory_uri() . '/assets/js/custom-script.js', array( 'jquery' ), esc_attr( $editorial_version ), true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'editorial_scripts' );
/*----------------------------------------------------------------------------------------------------------------*/
/**
* Current date at top header
*/
add_action( 'editorial_current_date', 'editorial_current_date_hook' );
if( ! function_exists( 'editorial_current_date_hook' ) ):
function editorial_current_date_hook() {
$date_option = get_theme_mod( 'editorial_header_date', 'enable' );
if( $date_option != 'disable' ) {
?>
name;
$cat_id = $cat_data->term_id;
$cat_link = get_category_link( $cat_id );
?>
ID;
}
$editorial_related_type = get_theme_mod( 'editorial_related_articles_type', 'category' );
$related_post_count = apply_filters( 'related_posts_count', 3 );
// Define related post arguments
$related_args = array(
'no_found_rows' => true,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
'ignore_sticky_posts' => 1,
'orderby' => 'rand',
'post__not_in' => array( $post_id ),
'posts_per_page' => $related_post_count
);
if ( $editorial_related_type == 'tag' ) {
$tags = wp_get_post_tags( $post_id );
if ( $tags ) {
$tag_ids = array();
foreach( $tags as $tag_ed ) {
$tag_ids[] = $tag_ed->term_id;
}
$related_args['tag__in'] = $tag_ids;
}
} else {
$categories = get_the_category( $post_id );
if ( $categories ) {
$category_ids = array();
foreach( $categories as $category_ed ) {
$category_ids[] = $category_ed->term_id;
}
$related_args['category__in'] = $category_ids;
}
}
$related_query = new WP_Query( $related_args );
if( $related_query->have_posts() ) {
echo '
';
while( $related_query->have_posts() ) {
$related_query->the_post();
?>
';
}
wp_reset_postdata();
?>
false ) );
$output_css = '';
foreach( $get_categories as $category ){
$cat_color = esc_attr( get_theme_mod( 'editorial_category_color_'.strtolower( $category->name ), $mt_theme_color ) );
$cat_hover_color = esc_attr( editorial_hover_color( $cat_color, '-50' ) );
$cat_id = esc_attr( $category->term_id );
if( !empty( $cat_color ) ) {
$output_css .= ".category-button.mt-cat-".$cat_id." a { background: ". $cat_color ."}\n";
$output_css .= ".category-button.mt-cat-".$cat_id." a:hover { background: ". $cat_hover_color ."}\n";
$output_css .= ".block-header.mt-cat-".$cat_id." { border-left: 2px solid ".$cat_color." }\n";
$output_css .= ".rtl .block-header.mt-cat-".$cat_id." { border-left: none; border-right: 2px solid ".$cat_color." }\n";
$output_css .= ".archive .page-header.mt-cat-".$cat_id." { border-left: 4px solid ".$cat_color." }\n";
$output_css .= ".rtl.archive .page-header.mt-cat-".$cat_id." { border-left: none; border-right: 4px solid ".$cat_color." }\n";
$output_css .= "#site-navigation ul li.mt-cat-".$cat_id." { border-bottom-color: ".$cat_color." }\n";
}
}
$output_css .= ".navigation .nav-links a,.bttn,button,input[type='button'],input[type='reset'],input[type='submit'],.navigation .nav-links a:hover,.bttn:hover,button,input[type='button']:hover,input[type='reset']:hover,input[type='submit']:hover,.edit-link .post-edit-link ,.reply .comment-reply-link,.home-icon,.search-main,.header-search-wrapper .search-form-main .search-submit,.mt-slider-section .bx-controls a:hover,.widget_search .search-submit,.error404 .page-title,.archive.archive-classic .entry-title a:after,#mt-scrollup,.widget_tag_cloud .tagcloud a:hover,.sub-toggle,#site-navigation ul > li:hover > .sub-toggle, #site-navigation ul > li.current-menu-item .sub-toggle, #site-navigation ul > li.current-menu-ancestor .sub-toggle{ background:". $mt_theme_color ."}\n";
$output_css .= ".navigation .nav-links a,.bttn,button,input[type='button'],input[type='reset'],input[type='submit'],.widget_search .search-submit,.widget_tag_cloud .tagcloud a:hover{ border-color:". $mt_theme_color ."}\n";
$output_css .= ".comment-list .comment-body ,.header-search-wrapper .search-form-main{ border-top-color:". $mt_theme_color ."}\n";
$output_css .= "#site-navigation ul li,.header-search-wrapper .search-form-main:before{ border-bottom-color:". $mt_theme_color ."}\n";
$output_css .= ".archive .page-header,.block-header, .widget .widget-title-wrapper, .related-articles-wrapper .widget-title-wrapper{ border-left-color:". $mt_theme_color ."}\n";
$output_css .= "a,a:hover,a:focus,a:active,.entry-footer a:hover,.comment-author .fn .url:hover,#cancel-comment-reply-link,#cancel-comment-reply-link:before, .logged-in-as a,.top-menu ul li a:hover,#footer-navigation ul li a:hover,#site-navigation ul li a:hover,#site-navigation ul li.current-menu-item a,.mt-slider-section .slide-title a:hover,.featured-post-wrapper .featured-title a:hover,.editorial_block_grid .post-title a:hover,.slider-meta-wrapper span:hover,.slider-meta-wrapper a:hover,.featured-meta-wrapper span:hover,.featured-meta-wrapper a:hover,.post-meta-wrapper > span:hover,.post-meta-wrapper span > a:hover ,.grid-posts-block .post-title a:hover,.list-posts-block .single-post-wrapper .post-content-wrapper .post-title a:hover,.column-posts-block .single-post-wrapper.secondary-post .post-content-wrapper .post-title a:hover,.widget a:hover,.widget a:hover::before,.widget li:hover::before,.entry-title a:hover,.entry-meta span a:hover,.post-readmore a:hover,.archive-classic .entry-title a:hover,
.archive-columns .entry-title a:hover,.related-posts-wrapper .post-title a:hover,.block-header .block-title a:hover,.widget .widget-title a:hover,.related-articles-wrapper .related-title a:hover { color:". $mt_theme_color ."}\n";
$refine_output_css = editorial_css_strip_whitespace( $output_css );
wp_add_inline_style( 'editorial-style', $refine_output_css );
}
endif;
/*----------------------------------------------------------------------------------------------------------------*/
add_action( 'editorial_before_page', 'wp_body_open', 10 );
/*----------------------------------------------------------------------------------------------------------------*/
/**
* Get minified css and removed space
*
* @since 1.2.5
*/
function editorial_css_strip_whitespace( $css ){
$replace = array(
"#/\*.*?\*/#s" => "", // Strip C style comments.
"#\s\s+#" => " ", // Strip excess whitespace.
);
$search = array_keys( $replace );
$css = preg_replace( $search, $replace, $css );
$replace = array(
": " => ":",
"; " => ";",
" {" => "{",
" }" => "}",
", " => ",",
"{ " => "{",
";}" => "}", // Strip optional semicolons.
",\n" => ",", // Don't wrap multiple selectors.
"\n}" => "}", // Don't wrap closing braces.
"} " => "}\n", // Put each rule on it's own line.
);
$search = array_keys( $replace );
$css = str_replace( $search, $replace, $css );
return trim( $css );
}