remove paginations functions only on home
You can try to sneak around the problem with a little if statement. Like this: <?php // If it’s not the homepage, do the pagination if(!is_home()){ echo gmr_get_pagination(); } ?> Hope this does the job.
You can try to sneak around the problem with a little if statement. Like this: <?php // If it’s not the homepage, do the pagination if(!is_home()){ echo gmr_get_pagination(); } ?> Hope this does the job.
That’s because you have directly edited the single.php file, try to make a function and in it return wp_link_pages() and in add_action set a priority. Try this function function pagination_after_post() { return wp_link_pages(); } add_action(‘the_content’,’pagination_after_post’,1); My WP PHP is not that good, my function might be wrong, this is just an example, but this way … Read more
$args = array(“role” => “subscriber”, “number” => 10); get_users($args); //First 10 Users with the Role Subscriber $args[‘offset’] = 10; get_users($args); //10th to 20th Users with the Role Subscriber and so on. Offset = page * number
OK, after no luck with wp_list_categories, I resorted to get_categories to get the pagination working. I hope this helps someone. <?php $args = array( ‘taxonomy’ => ‘categories’, ‘orderby’ => ‘term_group’, ‘hide_empty’ => 0, ‘hierarchical’ => 1, ‘exclude’ => ’16’, ‘parent’ => ‘0’, ); $categories = get_categories($args); $numOfItems = 60; $page = isset( $_GET[‘cpage’] ) ? … Read more
/** * Display pagination information in the format “X – Y of Z”. * * @param object $wp_query Optionally generate string from custom query, defaults to main. */ function wpse_106121_posts_count( $wp_query = null ) { if ( ! $wp_query ) global $wp_query; $posts = min( ( int ) $wp_query->get( ‘posts_per_page’ ), $wp_query->found_posts ); $paged = … Read more
You can use WP_Query instead of get_posts and then you can use the properties which are set for you: $post_count – The number of posts being displayed. $found_posts -The total number of posts found matching the current query parameters $max_num_pages – The total number of pages. Is the result of $found_posts / $posts_per_page
Forgive me for answering my own question, but this post gave me the answer I needed: WP_Query Pagination on single-custom.php I had to take a copy of the original wp_query $original_query = $wp_query; then assign my custom loop to the global $wp_query, and finally reset everything with wp_reset_postdata(); $wp_query = $original_query; In essence, this is … Read more
This is how mine looks: I got something similar from the original Timber Starter Theme that adds up to this: {% if posts.pagination.pages is not empty %} <nav class=”pagination is-centered” role=”navigation” aria-label=”pagination”> {% if pagination.pages|first and pagination.pages|first.current != true %} <a class=”pagination-previous” href=”https://wordpress.stackexchange.com/questions/345275/{{ pagination.pages”first.link }}”>First</a> {% else %} <a class=”pagination-previous” disabled>{{ __(‘First’, ‘calmar-lite’) }}</a> {% … Read more
You can send any request for author pages to a 404 with a simple action on parse_query. add_action( ‘parse_query’, ‘_404_author_archives’ ); function _404_author_archives( $qr ) { if( is_author() ) $qr->set_404(); } That should send any requests for an author page to a 404. If you wanted to go a bit further and remove the author … Read more
You can use the WordPress”nextpage” tag: <!–nextpage–> You just drop this into the HTML of your WordPress page wherever you want to break it up. I think your theme must support this tag in order to handle the pagination – on my site I have page “previous/next” links hidden, but most themes probably support this … Read more