Title: Adding custom post type to theme
Last modified: September 1, 2016

---

# Adding custom post type to theme

 *  Resolved [DocBray](https://wordpress.org/support/users/docbray/)
 * (@docbray)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/adding-custom-post-type-to-theme/)
 * Hello!
 * First I want to thank you for the great, responsive, free theme. Been using it
   for a few months and love it!
 * I have encountered an issue recently though. I have started to use the plugin
   IssueM (a magazine format plugin) and these create a custom post type called “
   article” (from the looks of things, and from looking here [https://wordpress.org/support/topic/related-posts-not-showing-up-3](https://wordpress.org/support/topic/related-posts-not-showing-up-3))
 * Since these are not normal “posts”, they do not show up on the homepage, in the
   slider, in any list of recent posts… well they don’t show anywhere but the special
   made IssueM pages.
 * There is an option in IssueM to use Categories and Tags that posts use, but this
   does not have them show up.
 * There is also a spot on their page that says to add this to the theme’s function.
   php:
 *     ```
       function add_articles_to_homepage( $query ) {
       if ( !is_admin() && is_home() && $query->is_main_query() ) {
       $query->set( 'post_type', array( 'post', 'article') );
       }
       return $query;
       }
       add_action( 'pre_get_posts', 'add_articles_to_homepage' );
       ```
   
 * But when I add this to the end of the functions.php, it just breaks the page.
 * I want to add the “article” post type to the loops that pull for content on the
   site and basically:
 * 1) Have the “article” post type show up on the homepage slider and the catagory
   lists
 * 2) Also have them show up in other areas that display recent posts
 * Thank you very much for any help with this! I’ve been poking around for a week,
   and everything that I have tried so far either didn’t work or broke the page 
   lol

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Theme Author [Richie KS](https://wordpress.org/support/users/rkcorp/)
 * (@rkcorp)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/adding-custom-post-type-to-theme/#post-7643848)
 * this is a custom query which the the theme do not have.
    customization or filter
   on query needed.
 * your code above should work, add them before end of ?> in functions.php
 * post type should work in slider, need to use the featured slider via post id.
 * 2. check plugin for sidebar widget for custom post type or use the theme built
   in multi custom post type widget in wp-admin->appeareance->widgets
 *  Thread Starter [DocBray](https://wordpress.org/support/users/docbray/)
 * (@docbray)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/adding-custom-post-type-to-theme/#post-7643901)
 * Thank you for the response. I have a bit of progress!
 * I was adding the quoted PHP code in it’s own php bracket at the end of the functions.
   php, so that is what was causing the page to break when added. When I added the
   way you said to, the page didn’t break!
 * Bonus is that the custom posts now show up in the archive pages for categories
   at least, since they use the same categories as posts do.
 * They don’t show up on the main page in the category lists though. But I’m poking
   around to try and fix that.
 * When I try to add the “articles” to the slider via post ID, it just displays 
   a blank rectangle for the slider. Looks like this: [https://i.sli.mg/HWeG6u.png](https://i.sli.mg/HWeG6u.png)
   But it’s something I’m going to poke around the slider code to try and fix. *
   crosses fingers*
 * I did find the Custom Post Type widget, and tried to play with it but it doesn’t
   show the “article” type to select. Not a big deal though.
 * Thanks again for the help so far! 😀
 *  Theme Author [Richie KS](https://wordpress.org/support/users/rkcorp/)
 * (@rkcorp)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/adding-custom-post-type-to-theme/#post-7643939)
 * > When I try to add the “articles” to the slider via post ID, it just displays
   > a blank rectangle for the slider. Looks like this:
 * need to choose default for the ‘how many posts to show?’ since you’re using featured
   post by id.
 * also enable ‘first featured image grab’ in customizer->general->posts
 *  Thread Starter [DocBray](https://wordpress.org/support/users/docbray/)
 * (@docbray)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/adding-custom-post-type-to-theme/#post-7643974)
 * Hey there! Had a busy work week, so I was just able to start poking around more
   on this.
 * The slider still just displays a dark rectangle, despite having the “First Featured
   Image” selected and trying to display a set number of posts via their post ID.
 * It makes me think there is something “special” (read:weird) about how these posts
   choose to display. I’m going to poke the plugin maker about this too, and keep
   poking around PHP.
 * FWIW they do not show up in the 2016 wordpress default theme, so it’s not like
   it’s an issue with just this theme.
 * Thanks again for the help so far!
 * EDIT: Considering it doesn’t work in the Twentysixteen theme as well, methinks
   its something with the plugin. If you wanted to mark this as resolved its fine.
   I DID get the posts to show in the category archives 😀 lol
 *  Theme Author [Richie KS](https://wordpress.org/support/users/rkcorp/)
 * (@rkcorp)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/adding-custom-post-type-to-theme/#post-7643976)
 * ok, you can open new thread support if have more question.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Adding custom post type to theme’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/mesocolumn/1.6.5.1/screenshot.
   png)
 * MesoColumn
 * [Support Threads](https://wordpress.org/support/theme/mesocolumn/)
 * [Active Topics](https://wordpress.org/support/theme/mesocolumn/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/mesocolumn/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/mesocolumn/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Richie KS](https://wordpress.org/support/users/rkcorp/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/adding-custom-post-type-to-theme/#post-7643976)
 * Status: resolved