i have a problem with wordpress, i have this piece
$paged = 1;
if ( get_query_var('paged') ) $paged = get_query_var('paged');
if ( get_query_var('page') ) $paged = get_query_var('page');
$contacts = new \WP_Query('post_type=contact&showposts=10&paged='.$paged);
if($contacts->have_posts()) {
echo '<table><thead><tr><th>First Name</th><th>Last Name</th><th>Email</th><th>Birthday</th></tr><thead><tbody>';
while($contacts->have_posts()) {
$contacts->the_post();
echo '<tr>';
echo '<td>'.get_post_meta($contacts->post->ID , 'contact_first_name' , true).'</td>';
echo '<td>'.get_post_meta($contacts->post->ID , 'contact_last_name' , true).'</td>';
echo '<td>'.get_post_meta($contacts->post->ID , 'contact_email' , true).'</td>';
echo '<td>'.get_post_meta($contacts->post->ID , 'contact_birthday' , true).'</td>';
echo '</tr>';
}
echo '</tbody></table>';
if ( get_next_posts_link() || get_previous_posts_link() ) {
echo '<div class="wp-navigation clearfix">
<div class="alignleft">'.next_posts_link('« Older Entries').'</div>
<div class="alignright">'.previous_posts_link('Newer Entries »').'</div>
</div>';
}
the problem is that the pagination is not working, i have tried some solutions like changing the name of $contacts to $wp_query but didn't work, also I changed showposts to posts_per_page and still not working, i think the problem is here: \WP_Query, how can i fix this? the plugin i'm working is on is already working in this way and only this part is giving problems