Home Forums Event Espresso Premium Custom Posts, Categories

Custom Posts, Categories

Posted: September 13, 2012 at 5:21 am

Aura Software

September 13, 2012 at 5:21 am


I am using event espresso 3.1.26.P

I have set up the custom posts so that in the wordpress dashboard I now have the “Event Posts” menu option (it contains submenu options of “event posts”, “add new” and “categories”.

Within “categories” I have created a category called “events”. which, according to the category, has 3 “event posts” within it.

This is all good. Also, I created these events using the “Create a Post” settings at the bottom of the Event Overview page…. but I don’t think that’s relevant.

The problem here is that if I click on the category “View” button, it takes me to /category/events/, but the 3 posts I would expect to see there are not shown.

Any idea how I can sort this out?

P.S. Also, while on this subject, I am a little confused over why event espresso has it’s own separate notion of categories to the wordpress one…. I’d love to know. To clear up any confusion, the problem I am having is with the wordpress category (as it pertains to custom post types).




September 13, 2012 at 6:44 am

I may be a little confused here, but you have set up a custom post type for the Event Posts that are generated? Have you registered a new taxonomy? The standard WP category taxonomy is only attached to the standard Post post type.

Regarding the PS, the Events are a custom post type, so it makes sense to have a custom taxonomy (categories) for that particular post type. This allows them to be categorised and therefore manipulated separately from the core Post Types or any other Post Types the site may have.

Aura Software

September 13, 2012 at 7:00 am

Hi Dean,

No, I have not set up a new taxonomy. I was following these instructions, linked in the post-type-samples readme.txt

Out of the box, it uses the same taxonomy for categories as the posts do…. I’m pretty sure that should work fine, I’ve seen it done elsewhere in wordpress, although it’s not that common. Categorisation cross-cuts the type of content.

Are you saying I have to set up a new taxonomy?

Regarding the P.S, my understanding is that basic EE events are not a post type, but still have the ability to categorise, no?


September 13, 2012 at 7:16 am

Hi Rob,

Let me look into this, and test it a bit, but I think I was misunderstanding you in respect to what you are trying to do.

EE events are definitely a custom post type, with their own taxonomy.


September 13, 2012 at 7:40 am


Yes I see the issue, not sure how to resolve it currently, but I will look into this one and get back to you. May not be today though.


September 14, 2012 at 5:49 am


I think the best solution for the moment is to amend the themes archive.php (if your theme doesnt have one, copy the index.php and rename it archive.php)

before the <?php if ( have_posts() ) : ?> paste

<?php query_posts( array('post_type' => array('espresso_event','posts'), 'cat' => $cat) ); ?>

This enables the Event Posts to be seen by the archive.

Aura Software

September 17, 2012 at 6:28 am

Hi Dean,

Thanks for your answer. It didn’t work for me, because the template uses a query string rather than an array.

What did work was this in the theme’s functions.php:

add_filter('pre_get_posts', 'eac_query_post_type');
function eac_query_post_type($query) {
  if(is_category() || is_tag()) {
    $post_type = get_query_var('post_type');
        $post_type = $post_type;
        $post_type = array('post','espresso_event'); 
    return $query;


September 17, 2012 at 8:17 am

Glad you got it worked out Rob and thanks for sharing your answer!

The support post ‘Custom Posts, Categories’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso