I'm building a website that's sole purpose is to display other websites (defined in the CPT). Think of it as a portfolio site for a company's digital assets. I have already defined the CPT and added websites to it. I created a portfolio-archive.php template (the CPT's name). Which is now accessed at the /portfolio slug. I want this to be the homepage of the site. How would I go about doing that?

  • If the portfolio slug is a page, you can set that as your homepage under settings > reading, otherwise you can just do it at the domain or server level. – Andrew Bartel May 17 '13 at 22:31
  • It's not a page, it's the archive page of a custom post type. I tried the settings>reading option, not helping. As far as a sever thing, I'm using WP Engine, what should I ask them? @AndrewBartel – Zach Russell May 17 '13 at 23:19

Rename portfolio-archive.php to front-page.php and change the post type for that page with a filter on pre_get_posts:

add_filter( 'pre_get_posts', 'wpse_99860_portfolio_on_front' );

function wpse_99860_portfolio_on_front( $query )
    // not the main loop
    if ( ! $query->is_main_query() )
        return $query;

    // not the front page
    if ( ! $query->is_front_page() )
        return $query;

    $query->set( 'post_type', array ( 'portfolio' ) );

    return $query;
| improve this answer | |
  • What if this theme is genesis theme? Would that make a difference? @toscho – Zach Russell May 17 '13 at 23:26
  • It shouldn’t. There is no "r" in my name … – fuxia May 17 '13 at 23:28
  • I was having FTP issues, I was finally able to make the changes. It seems to have worked minus keeping the correct styles. Any idea why? @toscho – Zach Russell May 18 '13 at 17:56
  • The output from body_class() is different on the front page. You might have to adjust the stylesheet. – fuxia May 18 '13 at 19:47
  • you're the best! – Zach Russell May 19 '13 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.