Last active
July 23, 2019 11:11
-
-
Save hakikz/4df833923c87c1e5522d8fd7acf74b67 to your computer and use it in GitHub Desktop.
WordPress Tweaks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*************************************** | |
Query and Pagination Code For Custom Taxonomy (taxonomy.php | |
***************************************/ | |
/* | |
After Apply These Code- | |
1. Please refresh the permalink from settings | |
2. And keep same the 'posts_per_page' => 10 and Settings > Readings> Blog pages show at most | |
*/ | |
<?php | |
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; | |
$args = array('posts_per_page' => 10, 'paged' => $paged,); | |
if ( have_posts() ) : | |
while ( have_posts() ) : the_post(); | |
?> | |
<h4><?php the_title(); ?></h4> | |
<p><?php the_content(); ?></p> | |
<?php | |
endwhile; | |
$big = 999999999; // need an unlikely integer | |
echo paginate_links( array( | |
'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ), | |
'format' => '?paged=%#%', | |
) ); | |
wp_reset_postdata(); | |
endif; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$big = 999999999; // need an unlikely integer | |
echo paginate_links( array( | |
'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ), | |
'format' => '?paged=%#%', | |
'current' => max( 1, get_query_var('paged') ), | |
'total' => $the_query->max_num_pages | |
) ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment