I'm using some code provided in an answer on here to calculate "post X of Y" and display pagination icons on single.php.
It works beautifully but it's causing problems displaying the_content();
On my local MAMP server it displays the content from the first post on every post, and on my web server it doesn't display the content at all.
My full code is below:
<div class="project-pagination">
<?php
// save current id to match later
$current_project_id = $post->ID;
$args = array(
'post_type' => 'portfolio',
'posts_per_page' => -1
);
$all_projects = new WP_Query( $args );
?>
<ul>
<?php
while( $all_projects->have_posts() ) : $all_projects->the_post();
// simple 'if' test to find the current post in the loop
// note that current_post starts at zero, which is why we add 1 to it.
// you can also output the_title, the_permalink, thumbnails, etc..
$permalink = get_permalink();
$projectnum = $all_projects->current_post+1;
if( $post->ID == $current_project_id ){
echo "<li class='project-page-btn-current'></li>";
}else {
echo "<li><a class='project-page-btn' href='".$permalink."'></a></li>";
}
endwhile;
?>
</ul>
</div>
Any help would be appreciated!
Thank you