WordPress.org

Support

Support » How-To and Troubleshooting » Adding CPT to homepage troubles…

Adding CPT to homepage troubles…

  • I’m trying to add a Recipe CPT (ReciPress plugin) to my homepage…

    I’m following Justin Tadlocks advice as found here:

    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

  • The topic ‘Adding CPT to homepage troubles…’ is closed to new replies.
Skip to toolbar