'#5a5560' ); add_theme_support( 'custom-background',$defaults); $args = array( 'default-image' => esc_url(get_template_directory_uri() . '/images/header_bg_1200.png'), 'default-text-color' => '000', 'width' => 1000, 'height' => 250, 'flex-width' => true, 'flex-height' => true ); add_theme_support( 'custom-header', $args ); $defaults = array( 'flex-height' => true, 'flex-width' => true ); add_theme_support( 'custom-logo', $defaults ); register_nav_menu('header_menu', __('Header navigation menu','eroshiksavp')); $formats=array('aside','gallery', 'link', 'image', 'quote','status', 'video', 'audio', 'chat'); add_theme_support('post-formats',$formats); add_theme_support( 'customize-selective-refresh-widgets' ); } } add_action( 'after_setup_theme', 'eroshiksavp_setup' ); //sidebar if ( ! function_exists( 'eroshik_savp_blog_sidebar_init' ) ) { function eroshik_savp_blog_sidebar_init() { register_sidebar( array( 'name' => __('Blog sidebar','eroshiksavp'), 'id' => 'eroshik-blog-sidebar', 'description' => __('Dynamic right blog sidebar','eroshiksavp'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); } add_action( 'widgets_init', 'eroshik_savp_blog_sidebar_init' ); } if ( ! function_exists( 'eroshik_savp_header_sidebar_init' ) ) { function eroshik_savp_header_sidebar_init() { register_sidebar( array( 'name' => __('Header Widget','eroshiksavp'), 'id' => 'eroshik-header-widget', 'description' => __('Dynamic header section','eroshiksavp'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'eroshik_savp_header_sidebar_init' ); } //widget page_top if ( ! function_exists( 'eroshik_savp_page_top_init' ) ) { function eroshik_savp_page_top_init() { register_sidebar( array( 'name' => __('Top page section','eroshiksavp'), 'id' => 'eroshik-page-top', 'description' => __('Dynamic top page section','eroshiksavp'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); } add_action( 'widgets_init', 'eroshik_savp_page_top_init' ); } //footer first widget area if ( ! function_exists( 'eroshik_savp_footer_first_init' ) ) { function eroshik_savp_footer_first_init() { register_sidebar( array( 'name' => __('Footer first column','eroshiksavp'), 'id' => 'eroshik-footer-first', 'description' => __('Dynamic footer first section','eroshiksavp'), 'before_widget' => '', 'before_title' => '
' ) ); } add_action( 'widgets_init', 'eroshik_savp_footer_first_init' ); } //footer second widget area if ( ! function_exists( 'eroshik_savp_footer_second_init' ) ) { function eroshik_savp_footer_second_init() { register_sidebar( array( 'name' => __('Footer second column','eroshiksavp'), 'id' => 'eroshik-footer-second', 'description' => __('Dynamic footer second section','eroshiksavp'), 'before_widget' => '', 'before_title' => '
' ) ); } add_action( 'widgets_init', 'eroshik_savp_footer_second_init' ); } //footer third widget area if ( ! function_exists( 'eroshik_savp_footer_third_init' ) ) { function eroshik_savp_footer_third_init() { register_sidebar( array( 'name' => __('Footer third column','eroshiksavp'), 'id' => 'eroshik-footer-third', 'description' => __('Dynamic footer third section','eroshiksavp'), 'before_widget' => '', 'before_title' => '
' ) ); } add_action( 'widgets_init', 'eroshik_savp_footer_third_init' ); } //footer fourth widget area if ( ! function_exists( 'eroshik_savp_footer_fourth_init' ) ) { function eroshik_savp_footer_fourth_init() { register_sidebar( array( 'name' => __('Footer fourth column','eroshiksavp'), 'id' => 'eroshik-footer-fourth', 'description' => __('Dynamic footer fourth section','eroshiksavp'), 'before_widget' => '', 'before_title' => '
' ) ); } add_action( 'widgets_init', 'eroshik_savp_footer_fourth_init' ); } //page sidebar if ( ! function_exists( 'eroshik_savp_page_sidebar_init' ) ) { function eroshik_savp_page_sidebar_init() { register_sidebar( array( 'name' => __('Page Sidebar','eroshiksavp'), 'id' => 'eroshik-page-sidebar', 'description' => __('Dynamic page sidebar','eroshiksavp'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); } add_action( 'widgets_init', 'eroshik_savp_page_sidebar_init' ); } //archive sidebar if ( ! function_exists( 'eroshik_savp_archive_sidebar_init' ) ) { function eroshik_savp_archive_sidebar_init() { register_sidebar( array( 'name' => __('Archive Sidebar','eroshiksavp'), 'id' => 'eroshik-archive-sidebar', 'description' => __('Dynamic archive sidebar','eroshiksavp'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); } add_action( 'widgets_init', 'eroshik_savp_archive_sidebar_init' ); } //posts formats if ( ! function_exists( 'eroshik_savp_posted_meta' ) ) { function eroshik_savp_posted_meta(){ $posted_on=human_time_diff(get_the_time('U'), current_time('timestamp')); $category=get_the_category(); $seperator=', '; $output=''; $i=1; if(!empty($category)){ foreach ($category as $cat){ if($i>1){ $output.=$seperator;}; $output.= ''. esc_html($cat->name).''; $i++; } } echo ' '.__('Posted','eroshiksavp').' '.esc_html($posted_on).' '.__('ago','eroshiksavp').' / '.$output.''; } } if ( ! function_exists( 'eroshik_savp_posted_footer' ) ) { function eroshik_savp_posted_footer(){ $comments_number=get_comments_number(); if(comments_open()){ //get comments links if($comments_number==0){ $comments=__('No comments','eroshiksavp'); }else if($comments_number>1){ $comments=$comments_number.' '.__('Comments','eroshiksavp'); }else{ $comments=__('One comment','eroshiksavp'); } $comments=''.$comments.''; }else{ $comments=__('Comments are closed','eroshiksavp'); } echo ''; } } if ( ! function_exists( 'eroshik_savp_get_attachment' ) ) { function eroshik_savp_get_attachment($num=1){ $output = ''; if (has_post_thumbnail() && $num == 1){ $output = wp_get_attachment_url(get_post_thumbnail_id(get_the_ID())); }else { $attachments = get_posts(array( 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'posts_per_page' => $num, 'post_status' => 'inherit' )); if ($attachments && $num == 1){ foreach ($attachments as $attachment){ $output = wp_get_attachment_url($attachment->ID); } }else if($attachments && $num > 1){ $output = $attachments; } wp_reset_postdata(); } return $output; } } if ( ! function_exists( 'eroshik_savp_get_embedded_media' ) ) { function eroshik_savp_get_embedded_media( $type = array() ){ $output=""; $content = do_shortcode( apply_filters( 'the_content', get_the_content() ) ); $embed = get_media_embedded_in_content( $content, $type ); if( in_array( 'audio' , $type) ){ $output = str_replace( '?visual=true', '?visual=false', $embed[0] ); }else{ if(isset($embed[0])){ $output = $embed[0]; } } return $output; } } if ( ! function_exists( 'eroshik_savp_get_bs_slides' ) ) { function eroshik_savp_get_bs_slides( $attachments ){ $output = array(); $count = count($attachments)-1; for( $i = 0; $i <= $count; $i++ ){ $active = ( $i == 0 ? ' active' : '' ); $n = ( $i == $count ? 0 : $i+1 ); $nextImg = wp_get_attachment_thumb_url( $attachments[$n]->ID ); $p = ( $i == 0 ? $count : $i-1 ); $prevImg = wp_get_attachment_thumb_url( $attachments[$p]->ID ); $output[$i] = array( 'class' => $active, 'url' => wp_get_attachment_url( $attachments[$i]->ID ), 'next_img' => $nextImg, 'prev_img' => $prevImg, 'caption' => $attachments[$i]->post_excerpt ); } return $output; } } if ( ! function_exists( 'eroshik_savp_grab_url' ) ) { function eroshik_savp_grab_url() { if( ! preg_match( '/]*?href=[\'"](.+?)[\'"]/i', get_the_content(), $links ) ){ return false; } return esc_url_raw( $links[1] ); } } if ( ! function_exists( 'eroshik_savp_grab_current_url' ) ) { function eroshik_savp_grab_current_url(){ $secure=""; if(!isset($_SERVER['HTTPS'])){ $secure='http://'; }else{ $secure='https://'; } $secure=esc_url($secure); if(isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])){ $referer=$secure.esc_url(wp_unslash($_SERVER['HTTP_HOST'])); $archive_url= $referer.esc_url(wp_unslash($_SERVER['REQUEST_URI'])); return $archive_url; } } } if ( ! function_exists( 'eroshik_savp_post_navigation' ) ) { function eroshik_savp_post_navigation(){ $nav = ''; echo $nav; } } if ( ! function_exists( 'eroshik_savp_get_post_navigation' ) ) { function eroshik_savp_get_post_navigation(){ if( get_comment_pages_count() > 1 && get_theme_mod( 'page_comments' ) ){ get_template_part('inc/templates/eroshik-savp-comment-nav'); } } } if ( ! isset( $content_width ) ) { $content_width = 400; } if(function_exists('eroshik_savp_add_editor_styles')) { function eroshik_savp_add_editor_styles() { add_editor_style( 'custom-editor-style.css' ); } add_action( 'admin_init', 'eroshik_savp_add_editor_styles' ); } ?>