How to hide empty pagination button when no previous page

<nav class=”pagination” role=”navigation”> <?php if( get_previous_posts_link() ) { ?> <div id=”prv” class=”button pag-btn nav-next”><?php previous_posts_link( ‘Previous’ ); ?></div> <?php } if( get_next_posts_link() ) { ?> <div id=”nxt” class=”button pag-btn nav-previous”><?php next_posts_link( ‘Next’ ); ?></div> <?php } ?> </nav> https://developer.wordpress.org/reference/functions/previous_posts_link/ https://developer.wordpress.org/reference/functions/get_previous_posts_link/

Numeric pagination custom post type

You’re referencing the global $wp_query object in your function which you’ve reset using wp_reset_query(). You can resolve the pagination by passing your custom $loop WP_Query object to the function. I also changed wp_reset_query to wp_reset_postdata Also you’re making the call to your pagination function in the while loop instead of after it. Your function should … Read more

how can I do numeric pagination?

There is a lot af possibilities. I use for few years this method : $all_post = get_posts($args); $nb_ppp = get_option(‘posts_per_page’); $nb_post = count($all_post); $nb_page = ceil($nb_post / $nb_ppp); $current_page = (!empty(get_query_var(‘paged’))) ? get_query_var(‘paged’) : 1; $args[‘offset’] = ($current_page == 1) ? 0 : (($current_page – 1) * $nb_ppp); $args[‘numberposts’] = $nb_ppp; $current_posts = get_posts($args); All … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)