'fff') ); add_theme_support( 'title-tag' ); add_theme_support( 'woocommerce' ); add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); /* Add theme support for post thumbnails (featured images). */ if (function_exists('add_theme_support')) { add_theme_support('post-thumbnails'); add_image_size('storymag_classic', 854, 540, true ); //(cropped) add_image_size('storymag_blog', 353, 220, true ); //(cropped) add_image_size('storymag_big', 650, 540, true ); //(cropped) add_image_size('storymag_small', 305, 270, true ); //(cropped) add_image_size('storymag_tabs', 100, 80, true ); //(cropped) } function storymag_thumb_url(){ $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 2100,2100 )); return esc_url($src[0]); } /* Add your nav menus function to the 'init' action hook. */ add_action( 'init', 'storymag_register_menus' ); /* Add your sidebars function to the 'widgets_init' action hook. */ add_action( 'widgets_init', 'storymag_register_sidebars' ); } function storymag_register_menus() { register_nav_menus(array( 'main-menu-left' => esc_html__( 'Main Menu (Left)','story-magazine' ), 'main-menu-right' => esc_html__( 'Main Menu (Right)','story-magazine' ), 'bottom-menu' => esc_html__( 'Footer Menu','story-magazine' ), )); } function storymag_register_sidebars() { register_sidebar(array('name' => esc_html__( 'Sidebar','story-magazine' ),'id' => 'tmnf-sidebar','description' => esc_html__( 'Sidebar widget section (displayed on posts / blog)','story-magazine' ),'before_widget' => '
','after_widget' => '
','before_title' => '

','after_title' => '

')); register_sidebar(array('name' => esc_html__( 'Sidebar (Sticky)','story-magazine' ),'id' => 'tmnf-sidebar-sticky','description' => esc_html__( 'Sidebar widget section (displayed on posts / blog)','story-magazine' ),'before_widget' => '
','after_widget' => '
','before_title' => '

','after_title' => '

')); register_sidebar(array('name' => esc_html__( 'Homepage Content','story-magazine' ),'id' => 'tmnf-homepage-content','description' => esc_html__( 'Magazine widget section (displayed on the homepage). Add widgets marked as "Home" into it.','story-magazine' ),'before_widget' => '
','after_widget' => '
','before_title' => '

','after_title' => '

')); //footer widgets register_sidebar(array('name' => esc_html__( 'Footer 1','story-magazine' ),'id' => 'tmnf-footer-1','description' => esc_html__( 'Widget section in footer - left','story-magazine' ),'before_widget' => '','after_widget' => '','before_title' => '

','after_title' => '

')); register_sidebar(array('name' => esc_html__( 'Footer 2','story-magazine' ),'id' => 'tmnf-footer-2','description' => esc_html__( 'Widget section in footer - center/left','story-magazine' ),'before_widget' => '','after_widget' => '','before_title' => '

','after_title' => '

')); register_sidebar(array('name' => esc_html__( 'Footer 3','story-magazine' ),'id' => 'tmnf-footer-3','description' => esc_html__( 'Widget section in footer - center/right','story-magazine' ),'before_widget' => '','after_widget' => '','before_title' => '

','after_title' => '

')); register_sidebar(array('name' => esc_html__( 'Footer 4','story-magazine' ),'id' => 'tmnf-footer-4','description' => esc_html__( 'Widget section in footer - right','story-magazine' ),'before_widget' => '','after_widget' => '','before_title' => '

','after_title' => '

')); } // Make theme available for translation load_theme_textdomain('story-magazine', get_template_directory() . '/lang' ); // customizer additions require get_template_directory() . '/functions/customizer.php'; require get_template_directory() . '/functions/custom-controls.php'; // header image $args = array( 'flex-width' => true, 'width' => 980, 'flex-height' => true, 'height' => 200, 'default-image' => '', ); add_theme_support( 'custom-header', $args ); /*----------------------------------------------------------------------------------- - Enqueues scripts and styles for front end ----------------------------------------------------------------------------------- */ function storymag_enqueue_style() { // main stylesheet wp_enqueue_style( 'lookout-default_style', get_stylesheet_uri()); // Font Awesome css wp_enqueue_style('font-awesome', get_template_directory_uri() . '/styles/font-awesome.min.css'); // mobile stylesheet wp_enqueue_style('lookout-mobile', get_template_directory_uri().'/style-mobile.css'); // google link function storymag_fonts_url() { $font_url = add_query_arg( 'family', urlencode( 'Libre Franklin:400,400i,700|Merriweather:300,400,700,400i|Montserrat:400,500,600,700&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese' ), "//fonts.googleapis.com/css" ); return $font_url; } wp_enqueue_style( 'lookout-fonts', storymag_fonts_url(), array(), '1.0.0' ); } add_action( 'wp_enqueue_scripts', 'storymag_enqueue_style' ); function storymag_enqueue_script() { // Load Common scripts wp_enqueue_script('jquery-scrolltofixed-min', get_template_directory_uri() .'/js/jquery-scrolltofixed-min.js',array( 'jquery' ),'', true); wp_enqueue_script('lookout-ownScript', get_template_directory_uri() .'/js/ownScript.js',array( 'jquery' ),'', true); // Singular comment script if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); } add_action('wp_enqueue_scripts', 'storymag_enqueue_script'); /*----------------------------------------------------------------------------------- - Include custom widgets ----------------------------------------------------------------------------------- */ include_once (get_template_directory() . '/functions/widgets/widget-featured.php'); include_once (get_template_directory() . '/functions/widgets/widget-featured-small.php'); include_once (get_template_directory() . '/functions/widgets/widget-social.php'); include_once (get_template_directory() . '/functions/widgets/widget-mag1.php'); include_once (get_template_directory() . '/functions/widgets/widget-mag2.php'); include_once (get_template_directory() . '/functions/widgets/widget-mag3.php'); /*----------------------------------------------------------------------------------- - Other theme functions ----------------------------------------------------------------------------------- */ // editor style add_action( 'init', 'storymag_add_editor_styles' ); function storymag_add_editor_styles() { $font_url = add_query_arg( 'family', urlencode( 'Libre Franklin:400,400i,500,700|Montserrat:400,500,600,700,400italic&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese' ), "//fonts.googleapis.com/css" ); add_editor_style( array($font_url, 'styles/admin.css') ); } // icons - font awesome function storymag_icon() { if(has_post_format('audio')) {return ''; }elseif(has_post_format('gallery')) {return ''; }elseif(has_post_format('image')) {return ''; }elseif(has_post_format('link')) {return ''; }elseif(has_post_format('quote')) {return ''; }elseif(has_post_format('video')) {return ''; } else {} } // link format function storymag_permalink() { $linkformat = get_post_meta(get_the_ID(), 'storymag_linkss', true); if($linkformat) echo esc_url($linkformat); else the_permalink(); } // excerpt class function storymag_class_to_excerpt( $excerpt ){ return '
'.$excerpt.'
'; } add_action('the_excerpt','storymag_class_to_excerpt'); // pagination function storymag_pagination( $args = array() ) { global $wp_rewrite, $wp_query; /* If there's not more than one page, return nothing. */ if ( 1 >= $wp_query->max_num_pages ) return; /* Get the current page. */ $current = ( get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1 ); /* Get the max number of pages. */ $max_num_pages = intval( $wp_query->max_num_pages ); /* Get the pagination base. */ $pagination_base = $wp_rewrite->pagination_base; /* Set up some default arguments for the paginate_links() function. */ $defaults = array( 'base' => esc_url(add_query_arg( 'paged', '%#%' )), 'format' => '', 'total' => $max_num_pages, 'current' => $current, 'prev_next' => true, 'show_all' => false, 'end_size' => 1, 'mid_size' => 1, 'add_fragment' => '', 'type' => 'plain', // Begin loop_pagination() arguments. 'before' => '', 'echo' => true, ); /* Add the $base argument to the array if the user is using permalinks. */ if ( $wp_rewrite->using_permalinks() && !is_search() ) $defaults['base'] = user_trailingslashit( trailingslashit( get_pagenum_link() ) . "{$pagination_base}/%#%" ); /* Allow developers to overwrite the arguments with a filter. */ $args = apply_filters( 'loop_pagination_args', $args ); /* Merge the arguments input with the defaults. */ $args = wp_parse_args( $args, $defaults ); /* Don't allow the user to set this to an array. */ if ( 'array' == $args['type'] ) $args['type'] = 'plain'; /* Get the paginated links. */ $page_links = paginate_links( $args ); /* Remove 'page/1' from the entire output since it's not needed. */ $page_links = preg_replace( array( "#(href=['\"].*?){$pagination_base}/1(['\"])#", // 'page/1' "#(href=['\"].*?){$pagination_base}/1/(['\"])#", // 'page/1/' "#(href=['\"].*?)\?paged=1(['\"])#", // '?paged=1' "#(href=['\"].*?)&\#038;paged=1(['\"])#" // '&paged=1' ), '$1$2', $page_links ); /* Wrap the paginated links with the $before and $after elements. */ $page_links = $args['before'] . $page_links . $args['after']; /* Allow devs to completely overwrite the output. */ $page_links = apply_filters( 'loop_pagination', $page_links ); /* Return the paginated links for use in themes. */ if ( $args['echo'] ) echo ($page_links); else echo wp_kses_post( $page_links ); } // meta sections function storymag_meta_cat() { ?>

'; esc_html_e('Written by: ','story-magazine'); the_author_posts_link();echo ''; ?>

'; } } } add_filter('manage_posts_columns', 'storymag_columns_head'); add_action('manage_posts_custom_column', 'storymag_columns_content', 10, 2); // site logo if ( ! function_exists( 'storymag_site_logo' ) ) : function storymag_site_logo() { if ( function_exists( 'the_custom_logo' ) ) { the_custom_logo(); } if (!has_custom_logo()) { ?>

WordPress', 'Story Magazine' ); ?>