WordPress.org

Ready to get started?Download WordPress

Forums

Adding CPT to homepage troubles... (1 post)

  1. kettlewell
    Member
    Posted 2 years ago #

    I'm trying to add a Recipe CPT (ReciPress plugin) to my homepage...

    I'm following Justin Tadlocks advice as found here:

    http://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page

    What I've found is that if I use this code:

    function my_get_posts( $query ) {
    	if ( is_home() && false == $query->query_vars['suppress_filters'])
    	  $query->set( 'post_type', array( 'post', 'recipe' ) );
    	return $query;
    }

    I get the post with the post_content (from the editor box) ... but not with the formatted recipe.

    However --

    If I add a post_type of page like so:

    function my_get_posts( $query ) {
    	if ( is_home() && false == $query->query_vars['suppress_filters'])
    	  $query->set( 'post_type', array( 'post', 'recipe', <strong>'page' </strong>) );
    	return $query;
    }

    Then I get the formatted CPT, but I'm also getting actual page's (obviously not what I'm after)

    I'm not sure why the post_type of page would show the formatted CPT nor what what correlation is...

    Could I get some guidance on what I need to do to add a formatted recipe CPT to my regular blog listing?

    Thanks

    Matt

Topic Closed

This topic has been closed to new replies.

About this Topic