Custom Post Types


I've been building basic themes for WP sites for a little while now but I've only just started trying to learn a framework and decided I would try Beans out before I spent money on a theme like Genesis. My developer skills are basic so I hope someone can help me get started here.

I've registered a custom post type via "functions.php" in my child theme but I can not get it to display on the frontend. I have read about including a custom template like "category-mycpt.php" or "archive-mycpt.php" but I'm not sure what code I would put in there and whether that is the most efficient way of doing it.

Currently if I click on any of the parent categories for my CPT I just get the "Whoops, no result found!" and the search bar. I would just like them to display like standard posts.

My main reason for trying to learn to use a framework is so I can try and take advantage of the built in resposiveness and SEO so it seems a bit counter intuitive to have to write a lot of my own code in a template file.

Any help to get started on this would be apprietiated thanks

You have to create custom wp_query for that ... There are many ways to achieve what you are trying to do ... The best way would be like this ...

beans_modify_action_callback( 'beans_loop_template', 'my_custom_loop' );

function my_custom_loop() {
  // write your custom querry here

Hey @sibience,

There's no need to create a custom loop to display custom post types.

After adding the code that register your custom post type, and having created one or two custom post types, make sure that you have refreshed your permalinks (Settings=>Permalinks=>click "Save").

Now, if you go to archive-mycpt.php, you should see your CPT.

Hope it helps.


Thanks for the replies.

I've already tried refreshing the permalinks with no change. All my custom post categories show up in the category widget but none of my custom posts attached to those categories apear.

I duplicated the index.php from the main Beans directory and tried renaming it to archive-mycpt.php and I also tried category-mycpt.php with no luck. Maybe I did something wrong? I am still very new to using frameworks.

If I go to the URLs for custom posts the posts are there but they don't seem to be attached to any categories. At the bottom where it says "filed under" it lists the categories the post is supposed to be attached to, but if I click one it still just shows me the "Whoops, no result found!" page.

I will look into CodeFactry's solution and see if i can get anywhere with that.


Ok after some time playing around with this I realised I needed to add my CPT to categories using this.

// Adds custom posts to categories
add_filter( 'pre_get_posts', 'my_get_posts' );

function my_get_posts( $query ) {
    if( !is_admin() ) {
        if ( !is_post_type_archive() && $query->is_archive() ) {
            $query->set( 'post_type', array( 'post', 'myCPT' ) );
        return $query;

One more unrelated question, is it possible to remove the archive link from the breadcrumb?

Hey Keith

I am not able to get my Custom Post Type categories and tags to show in the CPT category archive pages. Could you possibily share more details on how you got this working?

With below code I am able to show the default post meta. Such as date, author and add a comment but not the CPT categories and tags.

// Shows post meta on custom post archive/blog pages.
add_filter( 'beans_pre_post_meta', 'yourthemerpefix_keep_post_meta' );
function yourthemerpefix_keep_post_meta( $pre ) {
    // Don't short-circuit for 'YOURCUSTOMPOSTTYPE' post type.
    if ( 'movie' === get_post_type() ) {
        return false;
    if ( 'nettmagasin' === get_post_type() ) {
        return false;
    return $pre;

Mathieu shared the above code this post:

Thank you.

Hey Paal

I'm no expert on this but I think it may have something to do with how your CPT is set up.

It's been a while since I built that site but I don't remember having to do anything to get categories and tags to show up with my CPT.

I guess you could try adding it manually in the archive or category template.

Write a reply

Login or register to write a reply, it's free!