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

  1. kettlewell
    Posted 4 years ago #

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

    I'm following Justin Tadlocks advice as found here:


    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?



Topic Closed

This topic has been closed to new replies.

About this Topic