'; } } add_action( 'wp_head', 'basepress_pingback_header' ); if ( ! function_exists( 'basepress_default_menu' ) ) : /** * Display default page as navigation if no custom */ function basepress_default_menu() { echo '
'; } endif; if (! function_exists('basepress_infinitepaginate') ): /* |------------------------------------------------------------------------------ | Ajax Infinite Scroll |------------------------------------------------------------------------------ | | @return void | */ function basepress_infinitepaginate() { $theme_options = basepress_theme_options(); check_ajax_referer( 'basepress-load-more-nonce', 'nonce' ); $args = isset( $_POST['query'] ) ? array_map( 'esc_attr', $_POST['query'] ) : array(); $args['post_type'] = isset( $args['post_type'] ) ? esc_attr( $args['post_type'] ) : 'post'; $args['paged'] = esc_attr( $_POST['page'] ); $args['post_status'] = 'publish'; $loop = new WP_Query( $args ); if( $loop->have_posts() ): while( $loop->have_posts() ): $loop->the_post(); get_template_part( 'template-parts/content', esc_attr( $theme_options['post_layout'] ) ); endwhile; endif; wp_reset_postdata(); exit; } add_action('wp_ajax_infinite_scroll', 'basepress_infinitepaginate'); // for logged in user add_action('wp_ajax_nopriv_infinite_scroll', 'basepress_infinitepaginate'); endif; /* |------------------------------------------------------------------------------ | Infinite loading and more button |------------------------------------------------------------------------------ | | @return void | */ function basepress_infinite_loading($load_style = 'loadding') { global $wp_query; $totalPages = $wp_query->max_num_pages; if ($totalPages > 1) : if ($load_style != 'infinite'): ?> 0 ? intval ($theme_options['excerpt_length']) : $length; return $number; } add_filter( 'excerpt_length', 'basepress_excerpt_length', 999 ); function basepress_excerpt_more( $more ) { $theme_options = basepress_theme_options(); return esc_html($theme_options['excerpt_more']); } add_filter('excerpt_more', 'basepress_excerpt_more'); /** |------------------------------------------------------------------------------ | Related Posts |------------------------------------------------------------------------------ | | You can show related posts by Categories or Tags. | It has two options to show related posts | | 1. Thumbnail related posts (default) | 2. List of related posts | | @return void | */ if (! function_exists('basepress_related_posts') ) : function basepress_related_posts() { global $post; $theme_options = basepress_theme_options(); $taxonomy = $theme_options['related_post_taxonomy']; $numberRelated = $theme_options['number_related_post']; $args = array(); if ($taxonomy == 'tag') { $tags = wp_get_post_tags($post->ID); $arr_tags = array(); foreach($tags as $tag) { array_push($arr_tags, $tag->term_id); } if (!empty($arr_tags)) { $args = array( 'tag__in' => $arr_tags, 'post__not_in' => array($post->ID), 'posts_per_page'=> $numberRelated, ); } } else { $args = array( 'category__in' => wp_get_post_categories($post->ID), 'posts_per_page' => $numberRelated, 'post__not_in' => array($post->ID) ); } if (! empty($args) ) { $posts = get_posts($args); if ($posts) { ?> '; // tag before the current crumb $after = ''; // tag after the current crumb global $post; $homeLink = home_url(); if (is_home() || is_front_page()) { if ($showOnHome == 1) echo ''; } else { echo '