WordPress.org

Ready to get started?Download WordPress

Forums

Mixed custom post/post navigation problem on home page (4 posts)

  1. roske
    Member
    Posted 3 years ago #

    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.

  2. chinmoy
    Member
    Posted 3 years ago #

    $paged = get_query_var('paged')? get_query_var('paged') : 1

    put above code before $type = array('post', 'mr_project') ;

  3. roske
    Member
    Posted 3 years ago #

    This didn't work :(

  4. roske
    Member
    Posted 3 years ago #

    Any other idea? Something I can do to help?

Topic Closed

This topic has been closed to new replies.

About this Topic