add this pagination function:
function pagination( $query, $baseURL = get_bloginfo( $url ), $echo = true ) {
$page = $query->query_vars["paged"];
if ( !$page ) $page = 1;
$qs = $_SERVER["QUERY_STRING"] ? "?".$_SERVER["QUERY_STRING"] : "";
// Only necessary if there's more posts than posts-per-page
if ( $query->found_posts > $query->query_vars["posts_per_page"] ) {
$re = '<ul class="paging">';
// Previous link?
if ( $page > 1 ) {
$re .= '<li class="previous"><a href="'.$baseURL.'page/'.($page-1).'/'.$qs.'">« previous</a></li>';
}
// Loop through pages
for ( $i=1; $i <= $query->max_num_pages; $i++ ) {
// Current page or linked page?
if ( $i == $page ) {
$re .= '<li class="active">'.$i.'</li>';
} else {
$re .= '<li><a href="'.$baseURL.'page/'.$i.'/'.$qs.'">'.$i.'</a></li>';
}
}
// Next link?
if ( $page < $query->max_num_pages ) {
$re .= '<li><a href="'.$baseURL.'page/'.($page+1).'/'.$qs.'">next »</a></li>';
}
$re .= '</ul>';
if ($echo){
echo $re;
}else{
return $re;
}
}
}
then add the paged parameter to your shortcode query and get the current page permalink:
global $post;
$baselink = get_permalink($post->ID);
extract(shortcode_atts(array("country" => '' ), $atts));
$country = preg_replace('~?*([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $country );
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
$argsq = array (
'post_type' => 'quote',
'country' => $country,
'orderby' => 'meta_value', // you have to specify a meta_key for this to work
'page' => $page
);
$testim= get_posts($argsq );
and just before you return the pagination with your output:
return $output .pagination($testim,$baselink,false);