i got this function and its working properly without pagination, but right now i need some pagination on page as a listing is grow up now, how can i do that?
function listing_items($args){
global $wpdb;
$listQ = new WP_Query( $args );
$pid = get_the_ID( );
$return = '';
if ( $listQ->have_posts() ) {
while ( $listQ->have_posts() ) {
$listQ->the_post();
$listing = $wpdb->get_results( "SELECT * FROM wp_listings WHERE post_id =".get_the_ID() );
echo $pid;
$summary = $listing[0]->home_description;
$excerpt = wp_trim_words( $summary, $num_words = 25, $more ='.....' );
$return .= '<div class="listing-item" data-location="lat: '.$listing[0]->lat.', lng: '.$listing[0]->lng.'" data-lat="'.$listing[0]->lat.'" data-lng="'.$listing[0]->lng.'">';
$return .= '<div class="listing-image"><a href="'.esc_url( get_post_permalink() ).'">';
if( $listing[0]->image == '' ){
$return .= '<img src="http://via.placeholder.com/300x300" alt="" />';
} else {
$return .= '<img src="'.home_url().'/media/listings/'.get_the_ID().'/thumb_'.$listing[0]->image.'" alt="" />';
}
$return .= '</a></div>';
$return .= '<div class="listing-details">';
$return .= '<h3 class="listing-title"><a href="'.esc_url( get_post_permalink() ).'">'.$listing[0]->title.'</a></h3>';
$return .= '<div class="listing-detail">'.$listing[0]->accommodates . ' guests<span class="middot">·</span>' .$listing[0]->bedrooms . ' bedrooms<span class="middot">·</span>' .$listing[0]->bathrooms . ' bathrooms</div>';
$return .= '<div class="listing-excerpt">' .$excerpt.'</div>';
$return .= '<div class="listing-location"><a class="btn-listing" href="'.esc_url( get_post_permalink() ).'">Read More</a></div>';
$return .= '</div>';
$return .= '</div>';
}
/* Restore original Post Data*/
wp_reset_postdata();
return $return;
} else {
echo '<p class="no-response">No Listing yet here</p>';
}
}