WordPress.org

Support

Support » How-To and Troubleshooting » Mixed custom post/post navigation problem on home page

Mixed custom post/post navigation problem on home page

  • I’m trying to create a design portfolio website for myself, and wanted to use custom posts for “projects”. The problem is that home page always returns the same posts no matter what the page is.

    My setup is like this:

    • Home
      • Static “front page” named “My Home” that uses front-page.php as template
    • Projects
      • Static page named “Projects” and uses projects.php as template
    • Blog
      • Static page named Blog set up as “Posts page” and uses index.php as template.

    In the front-page.php I added the following code featured on the site:


    $type = array('post', 'mr_project') ;
    $args=array(
    'post_type' => $type,
    'post_status' => 'publish',
    'paged' => $paged,
    'posts_per_page' => 10,
    'caller_get_posts'=> 1
    );
    $temp = $wp_query; // assign orginal query to temp variable for later use
    $wp_query = null;
    $wp_query = new WP_Query($args);

    And the loop is pretty much unmodified.

    Similar code works for Projects and Blog page. Those pages use loop-projects.php and loop-blog.php.

    I’ve basicly went through all posts here, and tried using navigation plugins, but the effect is same.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Mixed custom post/post navigation problem on home page’ is closed to new replies.
Skip to toolbar