Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8514189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:47:37+00:00 2026-06-11T04:47:37+00:00

I have been unable to get my single-portfolio.php template to behave properly. So I

  • 0

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:

http://pastie.org/4268087

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,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:47:38+00:00Added an answer on June 11, 2026 at 4:47 am

    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:

        <?php
    
        if ( get_query_var('paged') ) {
            $paged = get_query_var('paged');
        } else if ( get_query_var('page') ) {
            $paged = get_query_var('page');
        } else {
            $paged = 1;
        }
    
        query_posts( array(
            'post_type' => 'case-study',
            'paged' => $paged,
            'posts_per_page' => 12,
            'post_status' => 'publish',
            'order' => 'ASC',
            'orderby' => 'menu_order'
        ));
    
        while (have_posts()) : the_post();
    
            if(!get_post_format()) {
                get_template_part('format', 'standard');
            } else {
                get_template_part('format', get_post_format());
            }
    
            $i++;
    
        endwhile;
    
        ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been unable to get my index.xhtml file to load properly, and I
I have only recently started using CakePHP and have been unable to get validation
I have been unable to find any documentation on properly closing database connections in
I'm adding Google Oauth2 to a Rails app, but have been unable to get
For whatever reason, I have been unable to get any table cells to have
I have been unable to get Riak working under Ubuntu 9 due to many
I've read over the similar questions on stackoverflow, but have been unable to get
I have been unable to get Visual Studio to present intellisense when working with
I have been unable to find any documentation on the .build method in Rails
I have been unable to find any decent documentation on this function. The code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.