Adding custom post type to static homepage

Hi, X

So I have this little problem,
There is this page right here

And I want to display some of it’s contents on the homepage

But I can’t seem to be able to do that
Is there a shortcode for this?
I want to display the content exactly as it is on that page

You will need to login to see the content so I’ll add the details in a secret chat

Thank you

Hi Wilfried,

Please install and activate the child theme and login through FTP then edit the functions.php then add this code:

function add_post_type( $types ) {

  $types['my_post_type'] = 'my_post_type';
  return $types;

}
add_filter( 'cs_recent_posts_post_types', 'add_post_type' );

Please change my_post_type with the Post Type slug you want to be added to the recent post element.

Once you added the code to the functions.php, the recent post element will look like this:

Hope this helps.

1 Like

Hi @wmmajaliwa and support team.

How can I add more than one custom post type. I have tried this code but only the first show in the menu. Sorry I am not a coder…:pensive:

function add_post_type( $types ) {

  $types['my_post_type'] = 'zenspiration';
  return $types;
  $types['my_post_type'] = 'zenaction';
  return $types;

}
add_filter( 'cs_recent_posts_post_types', 'add_post_type' );

Hello @Philippe,

To add multiple custom post type, you can make use of this code:

function add_post_type( $types ) {

  $types['zenspiration'] = 'zenspiration';
  $types['zenaction'] = 'zenaction';
  return $types;

}
add_filter( 'cs_recent_posts_post_types', 'add_post_type' );

We would love to know if this has worked for you. Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.