5, 'post_type' => 'post', 'ignore_sticky_posts' => true ) ); ?>
'post', 'post_status' => 'publish', 'posts_per_page' => $posts_perpage_value, 'order' => 'DESC', 'meta_query' => array( array( 'key' => '_thumbnail_id', 'compare' => '!=', 'value' => null ) ) ); if( ( $slider_posts_option == 'cat' ) && ( !empty( $slider_category ) ) ){ $slider_args['category_name'] = $slider_category; } $slider_query = new WP_Query( $slider_args ); $slide_counter = 0; if( $slider_query->have_posts() ) { echo '
'; while( $slider_query->have_posts() ) { $slide_counter++; $slider_query->the_post(); $post_id = get_the_ID(); $post_image_id = get_post_thumbnail_id(); $post_big_image_path = wp_get_attachment_image_src( $post_image_id, 'accesspress-mag-slider-big-thumb', true ); $post_small_image_path = wp_get_attachment_image_src( $post_image_id, 'accesspress-mag-slider-small-thumb', true ); $post_image_alt = get_post_meta( $post_image_id, '_wp_attachment_image_alt', true ); if( $slide_counter %4 == 1 ) { ?>
<?php echo esc_attr( $post_image_alt );?>

'; }?>
<?php echo esc_attr($post_image_alt);?>

'; }//endif wp_query } endif ; add_action( 'accesspress_mag_slider', 'accesspress_mag_slider_cb', 10 ); /*--------------------------------------------------------------------------------------------------------------*/ /** * Homepage Slider settings mobile */ if ( ! function_exists( 'accesspress_mag_slider_mobile_cb' ) ) : function accesspress_mag_slider_mobile_cb() { $slider_posts_option = of_get_option( 'slider_post_option', ' ' ); $slider_category = of_get_option( 'homepage_slider_category' ); $slide_count = of_get_option( 'count_slides' ); if( $slide_count == 0 ){ $posts_perpage_value = 4; } elseif( empty( $slider_category ) && $slider_posts_option == 'cat' ) { $posts_perpage_value = 4; } else { $posts_perpage_value = $slide_count*4; } $slide_info = of_get_option( 'slider_info' ); $slider_args = array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $posts_perpage_value, 'order' => 'DESC', 'meta_query' => array( array( 'key' => '_thumbnail_id', 'compare' => '!=', 'value' => null ) ) ); if( ( $slider_posts_option == 'cat' ) && ( !empty( $slider_category ) ) ){ $slider_args['category_name'] = $slider_category; } $slider_query = new WP_Query( $slider_args ); if( $slider_query->have_posts() ) { echo '
'; while( $slider_query->have_posts() ) { $slider_query->the_post(); $post_id = get_the_ID(); $post_image_id = get_post_thumbnail_id(); $post_big_image_path = wp_get_attachment_image_src( $post_image_id, 'accesspress-mag-slider-big-thumb', true ); $post_image_alt = get_post_meta( $post_image_id, '_wp_attachment_image_alt', true ); ?>
<?php echo esc_attr($post_image_alt);?>

'; } } endif ; add_action( 'accesspress_mag_slider_mobile', 'accesspress_mag_slider_mobile_cb', 10 ); /*------------------------------------------------------------------------------------------------------------*/ /** * Homepage Slider with highlight section */ if ( ! function_exists( 'accesspress_mag_slider_highlight_cb' ) ) : function accesspress_mag_slider_highlight_cb() { ?>
'post', 'post_status' => 'publish', 'posts_per_page' => 4, 'order' => 'DESC' ); if( !empty( $highlight_category ) ){ $highlight_args['category_name'] = $highlight_category; } $highlight_query = new WP_Query( $highlight_args ); if( $highlight_query->have_posts() ) { echo '
'; while ( $highlight_query->have_posts() ) { $highlight_query->the_post(); $post_image_id = get_post_thumbnail_id(); $post_image_path = wp_get_attachment_image_src( $post_image_id, 'accesspress-mag-singlepost-style1', true ); $post_image_alt = get_post_meta( $post_image_id, '_wp_attachment_image_alt', true ); ?>
<?php echo esc_attr( $post_image_alt );?>

'; } ?>
term_id; $cat_name = $single_info -> name; } $cat_link = get_category_link( $cat_id ); $cat_sec = ''. esc_attr( $cat_name ) .''; echo $cat_sec ; } endif; /*------------------------------------------------------------------------------------------------------------*/ /** * Sidebar layout for post & pages */ function accesspress_mag_sidebar_layout_class($classes){ global $post; if( is_404()){ $classes[] = ' '; }elseif(is_singular()){ $global_sidebar= esc_attr( of_get_option( 'global_post_sidebar', 'right-sidebar' ) ); $post_sidebar = get_post_meta( $post -> ID, 'accesspress_mag_sidebar_layout', true ); $page_sidebar = get_post_meta( $post -> ID, 'accesspress_mag_page_sidebar_layout', true ); if( 'post'==get_post_type() ){ if( $post_sidebar == 'global-sidebar' || empty( $post_sidebar ) ){ $post_class = $global_sidebar; } else { $post_class = $post_sidebar; } $classes[] = 'single-post-'.$post_class; } else { $classes[] = 'page-'.$page_sidebar; } } elseif(is_archive()){ $archive_sidebar = esc_attr( of_get_option( 'global_archive_sidebar' ) ); $classes[] = 'archive-'.$archive_sidebar; } elseif(is_search()){ $archive_sidebar = esc_attr( of_get_option( 'global_archive_sidebar' ) ); $classes[] = 'archive-'.$archive_sidebar; }else{ $classes[] = 'page-right-sidebar'; } return $classes; } add_filter( 'body_class', 'accesspress_mag_sidebar_layout_class' ); /*--------------------------------------------------------------------------------------------------------*/ /** * Template style layout for post and pages */ function accesspress_mag_template_layout_class($classes){ global $post; if( is_404()){ $classes[] = ' '; }elseif(is_singular()){ $global_template= esc_attr( of_get_option( 'global_post_template' ) ); $post_template = get_post_meta( $post -> ID, 'accesspress_mag_post_template_layout', true ); if('post'== get_post_type() ){ if( $post_template=='global-template' || empty( $post_template ) ){ $post_template_class = $global_template; } else { $post_template_class = $post_template; } $classes[] = 'single-post-'.$post_template_class; } } elseif(is_archive()){ $archive_template = esc_attr( of_get_option( 'global_archive_template' ) ); $classes[] = 'archive-page-'.$archive_template; } elseif(is_search()){ $archive_template = esc_attr( of_get_option( 'global_archive_template' ) ); $classes[] = 'archive-page-'.$archive_template; }else{ $classes[] = 'page-default-template'; } return $classes; } add_filter( 'body_class', 'accesspress_mag_template_layout_class' ); /*----------------------------------------------------------------------------------------------------------*/ /** * Website layout */ function accesspress_mag_website_layout_class( $classes ){ $website_layout = esc_attr( of_get_option( 'website_layout_option' ) ); if($website_layout == 'boxed' ){ $classes[] = 'boxed-layout'; } else { $classes[] = 'fullwidth-layout'; } return $classes; } add_filter( 'body_class', 'accesspress_mag_website_layout_class' ); /*---------------------------------------------------------------------------------------------------------------*/ /** * Meta post on */ if( ! function_exists( 'accesspress_mag_post_meta_cb' ) ): function accesspress_mag_post_meta_cb(){ global $post; $show_comment_count = of_get_option( 'show_comment_count', '1' ); if( $show_comment_count == 1 ) { $post_comment_count = get_comments_number( $post->ID ); echo ''.esc_attr( $post_comment_count ).''; } } endif ; add_action( 'accesspress_mag_post_meta', 'accesspress_mag_post_meta_cb', 10 ); /*-----------------------------------------------------------------------------------------------------------*/ /** * Posted on for home page */ if( ! function_exists( 'accesspress_mag_home_posted_on_cb' ) ): function accesspress_mag_home_posted_on_cb(){ global $post; $show_comment_count = of_get_option( 'show_comment_count', '1' ); $show_post_date = of_get_option( 'post_show_date', '1' ); $time_string = ''; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = ''; } $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); if($show_post_date==1){ $posted_on = sprintf( _x( '%s', 'post date', 'accesspress-mag' ), '' . $time_string . '' ); } else { $posted_on = ''; } echo '' . $posted_on . ''; if($show_comment_count==1){ $post_comment_count = get_comments_number( $post->ID ); echo ''.esc_attr( $post_comment_count ).''; } } endif; add_action( 'accesspress_mag_home_posted_on', 'accesspress_mag_home_posted_on_cb', 10 ); /*--------------------------------------------------------------------------------------------------------------*/ /** * Excerpt length (Effect on archive page only) */ if( ! function_exists( 'accesspress_mag_customize_excerpt_more' ) ): function accesspress_mag_customize_excerpt_more( $more ) { return '...'; } endif; add_filter( 'excerpt_more', 'accesspress_mag_customize_excerpt_more' ); if( ! function_exists( 'accesspress_mag_word_count' ) ): function accesspress_mag_word_count( $string, $limit ) { $string = strip_tags( $string ); $string = strip_shortcodes( $string ); $words = explode( ' ', $string ); return implode( ' ', array_slice( $words, 0, $limit )); } endif; if( ! function_exists( 'accesspress_mag_letter_count' ) ): function accesspress_mag_letter_count( $content, $limit ) { $striped_content = strip_tags( $content ); $striped_content = strip_shortcodes( $striped_content ); $limit_content = mb_substr( $striped_content, 0 , $limit ); if( $limit_content < $content ){ $limit_content .= "..."; } return $limit_content; } endif; /*-------------------------------------------------------------------------------------------------------------*/ /** * Get excerpt content (Effect only in archive page) */ if( ! function_exists( 'accesspress_mag_excerpt' ) ): function accesspress_mag_excerpt(){ global $post; $excerpt_type = esc_attr( of_get_option( 'excerpt_type' ) ); $excerpt_length = intval( of_get_option( 'excerpt_lenght' ) ); $excerpt_content = get_the_content($post -> ID); if( $excerpt_type == 'letters' ){ $excerpt_content = accesspress_mag_letter_count( $excerpt_content, $excerpt_length ); } else { $excerpt_content = accesspress_mag_word_count( $excerpt_content, $excerpt_length ); } echo '

'. $excerpt_content .'

'; } endif; /*------------------------------------------------------------------------------------------------------------*/ /** * BreadCrumb Settings */ if( ! function_exists( 'accesspress_mag_breadcrumbs' ) ): function accesspress_mag_breadcrumbs() { wp_reset_postdata(); global $post; $trans_here = esc_attr( of_get_option( 'trans_you_are_here', 'You are here' ) ); if( empty( $trans_here ) ){ $trans_here = __( 'You are here', 'accesspress-mag' ); } $trans_home = esc_attr( of_get_option( 'trans_home', 'Home' ) ); if( empty( $trans_home ) ){ $trans_home = __( 'Home', 'accesspress-mag' ); } $search_result_text = esc_attr( of_get_option( 'trans_search_results_for', 'Search Results for' ) ); if( empty( $search_result_text ) ) { $search_result_text = __( 'Search Results for ', 'accesspress-mag' ); } $showOnHome = 0; // 1 - show breadcrumbs on the homepage, 0 - don't show $delimiter = ' > '; // delimiter between crumbs $home = $trans_home; // text for the 'Home' link $showHomeLink = of_get_option( 'show_home_link_breadcrumbs' ); $showCurrent = of_get_option( 'show_article_breadcrumbs' ); // 1 - show current post/page title in breadcrumbs, 0 - don't show $before = ''; // tag before the current crumb $after = ''; // tag after the current crumb $homeLink = esc_url( home_url() ); if (is_home() || is_front_page()) { if ($showOnHome == 1) echo ''; } else { if($showHomeLink == 1){ echo '
'.esc_attr( $trans_here ).'
' . $home . ' ' . $delimiter . ' '; } else { echo '
'.esc_attr( $trans_here ).'
' . $home . ' ' . $delimiter . ' '; } if ( is_category() ) { $thisCat = get_category(get_query_var('cat'), false); if ($thisCat->parent != 0) echo get_category_parents($thisCat->parent, TRUE, ' ' . $delimiter . ' '); echo $before . single_cat_title('', false) . $after; } elseif ( is_search() ) { echo $before . $search_result_text.' "' . get_search_query() . '"' . $after; } elseif ( is_day() ) { echo '' . get_the_time('Y') . ' ' . $delimiter . ' '; echo '' . get_the_time('F') . ' ' . $delimiter . ' '; echo $before . get_the_time('d') . $after; } elseif ( is_month() ) { echo '' . get_the_time('Y') . ' ' . $delimiter . ' '; echo $before . get_the_time('F') . $after; } elseif ( is_year() ) { echo $before . get_the_time('Y') . $after; } elseif ( is_single() && !is_attachment() ) { if ( get_post_type() != 'post' ) { $post_type = get_post_type_object(get_post_type()); $slug = $post_type->rewrite; echo '' . $post_type->labels->singular_name . ''; if ($showCurrent == 1) echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after; } else { $cat = get_the_category(); $cat = $cat[0]; $cats = get_category_parents($cat, TRUE, ' ' . $delimiter . ' '); if ($showCurrent == 0) $cats = preg_replace("#^(.+)\s$delimiter\s$#", "$1", $cats); echo $cats; if ($showCurrent == 1) echo $before . get_the_title() . $after; } } elseif ( !is_single() && !is_page() && get_post_type() != 'post' && !is_404() ) { $post_type = get_post_type_object(get_post_type()); echo $before . $post_type->labels->singular_name . $after; } elseif ( is_attachment() ) { $parent = get_post($post->post_parent); $cat = get_the_category($parent->ID); $cat = $cat[0]; echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' '); echo '' . $parent->post_title . ''; if ($showCurrent == 1) echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after; } elseif ( is_page() && !$post->post_parent ) { if ($showCurrent == 1) echo $before . get_the_title() . $after; } elseif ( is_page() && $post->post_parent ) { $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = '' . get_the_title($page->ID) . ''; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); for ($i = 0; $i < count($breadcrumbs); $i++) { echo $breadcrumbs[$i]; if ($i != count($breadcrumbs)-1) echo ' ' . $delimiter . ' '; } if ($showCurrent == 1) echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after; } elseif ( is_tag() ) { echo $before . 'Posts tagged "' . single_tag_title('', false) . '"' . $after; } elseif ( is_author() ) { global $author; $userdata = get_userdata($author); echo $before . 'Author: ' . $userdata->display_name . $after; } elseif ( is_404() ) { echo $before . 'Error 404' . $after; } else { } if ( get_query_var('paged') ) { if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' ('; echo __('Page' , 'accesspress-mag') . ' ' . get_query_var('paged'); if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')'; } echo '
'; } } endif; /*-------------------------------------------------------------------------------------------------------------*/ /** * * Replace function for WooCommerce breadcrumbs */ add_filter( 'woocommerce_breadcrumb_defaults', 'accesspress_mag_woocommerce_breadcrumbs' ); if( ! function_exists( 'accesspress_mag_woocommerce_breadcrumbs' ) ): function accesspress_mag_woocommerce_breadcrumbs() { $seperator = ' > '; $trans_home = esc_attr( of_get_option( 'trans_home', 'Home' ) ); if( empty( $trans_home ) ){ $trans_home = __( 'Home', 'accesspress-mag' ); } $home_text = $trans_home ; $trans_here = esc_attr( of_get_option( 'trans_you_are_here', 'You are here' ) ); if( empty( $trans_here ) ){ $trans_here = __( 'You are here', 'accesspress-mag' ); } return array( 'delimiter' => " ".$seperator." ", 'before' => '', 'after' => '', 'wrap_before' => '', 'home' => $home_text ); } endif; add_action( 'init', 'accesspress_mag_remove_wc_breadcrumbs' ); function accesspress_mag_remove_wc_breadcrumbs() { remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 ); } $accesspress_show_breadcrumb = of_get_option( 'show_hide_breadcrumbs', '1' ); if( ( function_exists( 'accesspress_mag_woocommerce_breadcrumbs' ) && $accesspress_show_breadcrumb == 1 ) ) { add_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 10, 0 ); } /*----------------------------------------------------------------------------------------------------*/ /** * Remove bbpress breadcrumbs */ if( ! function_exists( 'accesspress_mag_bbp_no_breadcrumb' ) ): function accesspress_mag_bbp_no_breadcrumb ($arg){ return true ; } endif; add_filter('bbp_no_breadcrumb', 'accesspress_mag_bbp_no_breadcrumb' ); /*---------------------------------------------------------------------------------------------------------*/ /** * Random Post in header */ if ( ! function_exists( 'accesspress_mag_random_post' ) ) : function accesspress_mag_random_post() { $get_random_post = new WP_Query( array( 'posts_per_page' => 1, 'post_type' => 'post', 'ignore_sticky_posts' => true, 'orderby' => 'rand' ) ); ?>
have_posts() ) { while( $get_random_post->have_posts() ) { $get_random_post->the_post(); ?>