I am trying to add pagination to posts however i cannot figure out how to get it to work - it simply does not show the pagination as i need it to. It should display the first 15 posts on the first page, then should paginate all other posts.
Any ideas?
function latestreleases() {
$args = array( 'cat' => '-1, -2', 'paged' => $paged, 'posts_per_page' => 15 );
$last_5_posts_query = new WP_Query( $args );
while($last_5_posts_query->have_posts()) :
$last_5_posts_query->the_post();
$link = get_permalink();
$title = get_the_title();
$description = excerpt(16);
$details = 'Watch ';
$readmore = 'Read more...';
$paginate = paginate_links();
$content .= '<div class="all-latest-movies">';
$content .= '<h3><a href='.$link.' target="_blank">'.$title.'</a></h3>';
$content .= '<div class="thumbnail"><a href=" '.$link. ' " target="_blank">'
. get_the_post_thumbnail( null, "home-movie-thumbnail")
. '</a></div>';
$content .= '<div class="ratings">'. ( function_exists("the_ratings") ? the_ratings() : '' ) .'</div>';
$content .= '<div class="description">' .$description. ' <a href= '.$link.' >' .$readmore. '</div>';
$content .= '<div class="view-listing"><a href= '.$link.' target="_blank" >' .$details. $title. '</a></div>';
$content .= '</div><!-- .fetured-movies -->';
endwhile;
return $content;
echo '<nav>';
echo '<div>'.get_next_posts_link('Older', $the_query->max_num_pages).'</div>'; //Older Link using max_num_pages
echo '<div>'.get_previous_posts_link('Newer', $the_query->max_num_pages).'</div>'; //Newer Link using max_num_pages
echo "</nav>";
}
add_shortcode('LatestReleases', 'latestreleases' );