I have been unable to get my single-portfolio.php template to behave properly.
So I have a custom post type called portfolio. I am displaying all of those posts in the front-page.php and it works perfectly fine. Here is the loop for the front-page.php:
For the life of me however, I cannot get the right post to show up in my single-portfolio.php template.
Basically, if I go to one of my posts (so for example, lets say http://example.com/portfolio/test-post/) I end up with a single post page that displays the wrong post (so instead of “test-post” I get “wrong-post”). No matter what post I open up, it will be the exact same post that is displayed (“wrong-post”). If I set the posts_per_page to infinite, it will show me all of the posts.
I have tried many different Loops. I have tried the exact same loop as shown above, as well as the default custom post type loop found in the WordPress Codex.
Any suggestions on how to solve this?
Thanks,
Zourbuth’s solution did not work for me, however, after much failing, I found the best solution for pagination and single pages for Custom Post Types in WordPress. Here is my loop: