Server : Apache System : Linux server.lienzindia.com 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64 User : plutus ( 1007) PHP Version : 7.4.33 Disable Function : NONE Directory : /home/plutus/public_html/wp-content/themes/vrm/partials/ |
Upload File : |
<?php use TotalThemeCore\Post_Series; /** * Post Series. * * @package Total WordPress theme * @subpackage Partials * @version 5.8.1 */ defined( 'ABSPATH' ) || exit; // Return if taxonomy doesn't exist or the post is password protected. if ( ! taxonomy_exists( 'post_series' ) || post_password_required() ) { return; } // Store current Post object. $current_post = get_post(); // Get post terms. $terms = get_the_terms( $current_post, 'post_series' ); // Return if not term found. if ( empty( $terms ) || is_wp_error( $terms ) ) { return; } $query_order = is_callable( [ 'TotalThemeCore\Post_Series', 'get_query_order' ] ) ? Post_Series::get_query_order() : 'ASC'; // Post query args. $args = (array) apply_filters( 'wpex_post_series_query_args', [ 'post_type' => get_post_type(), 'posts_per_page' => -1, 'orderby' => 'date', 'order' => $query_order, 'no_found_rows' => true, 'tax_query' => [ [ 'taxonomy' => 'post_series', 'field' => 'id', 'terms' => $terms[0]->term_id ] ], ] ); // Get all posts in series. $wpex_query = new wp_query( $args ); // Display series if posts are found. if ( $wpex_query->have_posts() ) : ?> <div class="wpex-post-series-toc wpex-boxed wpex-p-30"> <div class="wpex-post-series-toc-header wpex-text-1 wpex-text-xl wpex-font-semibold wpex-mb-15"><a class="wpex-inherit-color wpex-no-underline" href="<?php echo esc_url( get_term_link( $terms[0], 'post_series' ) ); ?>"><?php echo esc_html( $terms[0]->name ); ?></a></div> <div class="wpex-post-series-toc-list wpex-last-mb-0"><?php // Loop through posts. $count=0; foreach ( $wpex_query->posts as $post ) : setup_postdata( $post ); $count++; $is_current_post = ( $post->ID === $current_post->ID ); $entry_classes = [ 'wpex-post-series-toc-entry', 'wpex-mb-5', ]; if ( $is_current_post ) { $entry_classes[] = 'wpex-active'; } ?> <div class="<?php echo esc_attr( implode( ' ', $entry_classes ) ); ?>"> <span class="wpex-post-series-toc-number post-series-count wpex-font-medium"><?php echo absint( $count ); ?>.</span> <?php if ( $is_current_post ) { ?> <?php the_title(); ?> <?php } else { ?> <a href="<?php wpex_permalink(); ?>" title="<?php wpex_esc_title(); ?>" class="wpex-post-series-toc-link wpex-hover-underline"><?php the_title(); ?></a> <?php } ?> </div> <?php endforeach; ?></div> </div> <?php endif; // Reset post data to prevent conflicts with other queries. wp_reset_postdata();