WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Displaying EM Events together with normal WP Posts (6 posts)

  1. Balders
    Member
    Posted 1 year ago #

    Sorry for opening this topic again, but this is something which really haunts me. And after doing some research on the web, there are lots of users who would like to display em events as normal wp posts on the front page.

    What I've done so far:

    I put this code in the functions.php:
    
    add_action('init', 'my_em_taxonomies');
    function my_em_taxonomies() {
        register_taxonomy_for_object_type('post_tag', EM_POST_TYPE_EVENT);
        register_taxonomy_for_object_type('category', EM_POST_TYPE_EVENT);
    }

    I put this filter after it:

    add_filter( 'pre_get_posts', 'my_get_posts' );
    
    function my_get_posts( $query ) {
    
    	if ( is_home() && $query->is_main_query() )
    		$query->set( 'post_type', array( 'post', 'event' ) );
    
    	return $query;
    }

    But the event still doesn't show up on the homepage. Where did I go wrong? Or what did I miss?

    Thanks for helping. Problem is my site basically exists only of events. At the monent I have to copy every event to show up as post which is very time consuming.

    Cheers

    http://wordpress.org/extend/plugins/events-manager/

  2. agelonwl
    Member
    Posted 1 year ago #

    Hi,

    can I know the name of the theme you are using?

  3. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    see http://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page

    our post type name is event, or better yet, use the constant EM_POST_TYPE_EVENT (no quotes around it)

  4. Balders
    Member
    Posted 1 year ago #

  5. Balders
    Member
    Posted 1 year ago #

    I tried Justin Tadlock, doesn't work for my theme.

    On front page I display 5 posts of each category I setup in admin/theme options. Please have a look here: http://www.der-backnanger.de Categories like Musik, Party/DJ, Kabarett, Theater and so on.

    Cheers again

  6. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    In that case you'd probably need to modify your theme to get this to work.

    Firstly we don't share categories with post categories, we use a custom taxonomy.

    Secondly, your theme is probably only looking for regular post types, and we use event custom post types.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic