Are you maybe looking for something like this?
/**
* Outputs blog / archive pagination
*
*/
function my_pagination(){
global $wp_query;
$total_pages = $wp_query->max_num_pages;
if ($total_pages > 1):
$current_page = max(1, get_query_var('paged'));
echo paginate_links(array(
'current' => $current_page,
'total' => $total_pages,
'prev_text' => 'Prev',
'next_text' => 'Next',
'type' => 'list'
));
endif;
}
Then include it in your theme likeso
<?php if ( $family_query->have_posts() ) : ?>
<?php while ( $family_query->have_posts() ) : ?>
<?php $family_query->the_post(); ?>
<h3><?php echo esc_attr( get_the_title() ); ?></h3>
<?php endwhile; ?>
<?php my_pagination(); ?>
Related Posts:
- Where to put my code: plugin or functions.php?
- Mini-Site Strategy
- How to put custom post types on front page
- How to set a fall back template for a custom post type in a plugin?
- How to add multiple images to a custom post type single post?
- Where to put archive-{post-type}.php
- WP Query group/order by category name
- Custom Taxonomy and tax_query Issue?
- How do I create an archive page for standard posts?
- need advice on how to do a lists using custom post types – taxonomy vs postmeta
- How to Get Current Custom Post Type Selected Taxonomy Term (Not All Terms)
- Orderby CPT custom fields not working
- How to have this permalink structure: post_type/postname/custom_inner_page
- custom comments form for custom post type
- Redirect to another page using contact form 7? [closed]
- detect your custom post type in WordPress
- Custom WP_Query doesn’t display all posts
- WP_Query with custom post type ID
- how to get this tax_query working?
- How to Use Custom Meta Field Instead of CPT Title in Post URL
- Searching post types
- filter the_content, custom post type, and wp_query
- Make Next and Previous on single-$posttype.php use the same order as archive-$posttype.php
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- Not Able to Add New Class To CPT Attachment Image
- Wp Meta Query does not work while simple Query Works
- Custom post category name showing empty
- How to store the third party script with HTML code in the wordpress custom input field?
- Error 404 change permalink term custom term taxonomy
- How to search through all child taxonomies using WP_Query?
- I have a random letter appearing before my content. Where to start looking for the cause?
- Having issue on Loading Meta Data From CSV to CPT
- Front End users account with lots of user Roles (not Woocommerce)
- Custom post type that lets users create a set of posts?
- call a function when insert and update a custom post type
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- Error in WP Query. If variable is empty it is displaying previous post value
- Not Able to Get Custom Post Type in Single and Single-custom-post-type
- How to develop custom URL redirection
- Loop carousel slider in wordpress
- Custom post type not being pulled in widget
- Issue on Counting CPT’s Under Taxonomy Term
- Not Able to Display Metabox Saved Checkbox and Selected option After Save/ Update
- How to manage wordpress knowledge base/wiki/posts collections
- Need some hints for my own WP theme development
- Default WordPress Query for a Specific Custom Post Type URL
- Meta query with boolean true/false value
- Search multiple custom fields by using meta_query
- How to add multiple images to custom post type?
- category__in not working on custom post type
- Date query for a custom meta field
- WordPress metabox file upload in custom post [duplicate]
- Querying Posts by Taxonomy From Alternate Network Site
- working Custom Post Type and Widget code no longer works when moved from functions.php to plugin
- Combine tax_query and meta_query in WP_Query
- How do I add a custom button to my “edit” list? ( edit.php?post_type= ) beside “Add New”
- Custom WP_Query not returning results when querying custom post type
- Get all of user’s custom post types in WP Admin for plugin
- WP_Query: include custom post type only with specific meta value
- Allow non-logged in users to see a future post after clicking on a list of future posts
- Problem querying Custom post type by custom fields
- Query Multiple Custom Posts by Custom Fields
- How to Upload CSV Data into Custom Post Type Data with Metabox programmatically
- Adding a metabox on a CPT’s submenu page
- can these 3 queries be re-written as 1 query?
- cannot override post_types in WP_Query()
- Wrapping x posts in html without leaving empty html
- Loop for custom post types filtered by a taxonomy
- ACF in wordpress
- Theme independent plugin by using default page template
- Api rest_route 404 while building filter for custom posts (filtered by multiple meta keys / custom fields)
- Custom post type’s posts are not showing anywere but in xml sitemap
- Custom post type and custom taxonomy 404 on page 2
- Can’t change posts per page in WordPress Post Type Query
- If Post type use sidebar (‘tree’)
- Creating a Tabbed Widget
- Having Issue on Getting Metabox Checkbox Value
- set object terms after some some time of published post – functions.php
- Custom Endpoint For Specific Custom Post Type
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- How to display the post using a shortcode in WordPress?
- Numeric pagination custom post type
- Shortcode and get_template_part
- dynamic vue widget inside custom post
- WP Query filter search. Result show all posts instead just custom post type
- how to allow subscriber to add/edit/delete custom post type
- Facing some Issues on Two Parts Custom Post Type Taxonomy Names
- get_post_meta for Custom Post Type ( CPT )
- call_user_func_array() error after moving to another server
- WP_Query for CPT with filter by another WP_Query
- How to query posts by meta keys AND under specific category?
- Shortcode display CPT Query only showing 1 post?
- Query stopped working
- How can I base a query off of the current page post type AND a meta value from another custom post type
- WP_Query and two custom fields returns no posts
- Function that get ACF fields value before saving
- Fallback if statement based on the number filtered from it
- How to apply order on custom taxonomy and custom meta key on custom post type
- Change position of Post Formats box?
- WP Query – Can’t get posts with specific taxonomy