4.2-alpha title-tag bug
-
Hi there! When there is category of grandchild, flip to the second page title tag display can’t find the page.
functions.php code –add_theme_support('title-tag'); function vb_pagination( $query=null ) { global $wp_query; $query = $query ? $query : $wp_query; $big = 999999999; $paginate = paginate_links( array( 'base' => str_replace('#038;','',str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) )), 'type' => 'array', 'total' => $query->max_num_pages, 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'prev_text' => __('<i class="fa fa-chevron-left"></i>', LANGUAGE_ZONE), 'next_text' => __('<i class="fa fa-chevron-right"></i>', LANGUAGE_ZONE) ) ); if ($query->max_num_pages > 1) : ?> <ul class="pagination pagination-md"> <?php foreach ( $paginate as $page ) { echo '<li>' . $page . '</li>'; } ?> </ul> <?php endif; }
body code –
<?php if ( get_query_var('paged') ) { $paged = get_query_var('paged'); } else if ( get_query_var('page') ) { $paged = get_query_var('page'); } else { $paged = 1; } $my_args = array( 'cat' => get_query_var('cat'), 'posts_per_page' => 1, 'paged' => $paged ); $the_query = new WP_Query( $my_args ); if ( $the_query->have_posts() ) : ?> <?php ?> <?php while($the_query->have_posts()):$the_query->the_post();?> <div class="row"> <div class="col-md-6"> <?php echo get_the_post_thumbnail( $post_id ); ?> </div> <div class="col-md-6"> <h1><?php the_title(); ?></h1> </div> </div> <?php endwhile; endif; wp_reset_postdata(); ?> </article> <!-- row start --> <div class="row text-center"> <?php if ( function_exists('vb_pagination') ) { vb_pagination( $the_query ); } ?> </div> <!-- row end -->
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘4.2-alpha title-tag bug’ is closed to new replies.