• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2665

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

Include Different Post Types In Your Home Page Loop

This post includes several PHP snippets you can use to include different posts types on your home page loop.

Here’s the question this post provides the answer to:

I am wanting to add a CPT to the homepage along with Posts

Copy one of these snippets from the view raw link in the Gist and paste it at the end of your child themes functions file using a code editor.

All Post Types

This code will include all post types like posts, pages and custom post types.

Posts & Custom Post Types

This code will include your regular posts and the post type you add to the array in the code. Simply replace your-cpt with the name of your custom post type and add multiple CPT’s separated by a comma if needed.

Posts & Pages

This code includes both posts and pages in your home page loop

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems