Using categories from Events Manager plugin in Graphene slider

  • jmek66

    #5319

    This is one of those annoying questions that crosses the border between your theme and someone else’s plugin, so I’m not sure if you can help. But I certainly would appreciate it!

    I am using the WP Events Manager Pro Plugin for my calendar and would like to include some of the events (which are a custom post type) in te Graphene slider. The Events Manager people provided the code below to add the ability to assign standard categories to the custom-post-type Event posts. The code IS adding the Categories box to my Events posts and the Events show up as being in the correct category. However, the Graphene slider isn’t picking up the Event post. Any ideas?

    My php skills are VERY minimal, so I’m not sure if I need to change something in the code or move some of it to one of the Graphene hooks or….. Any help would be appreciated (I am also posting this question to the plugin’s support forums).

    My functions.php now looks like this:

    <?php

    // The height and width of your custom header. You can hook into the theme's own filters to change these values.
    // Add a filter to twentyten_header_image_width and twentyten_header_image_height to change these values.
    define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 960 ) );
    define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 100 ) );

    // Add Events Manager Categories to regular categories

    add_action('init', 'demo_add_default_boxes');
    function demo_add_default_boxes()
    {
    register_taxonomy_for_object_type('category', 'event');
    register_taxonomy_for_object_type('post_tag', 'event');
    }

    add_filter('pre_get_posts', 'query_post_type');
    function query_post_type($query) {
    if(is_category() || is_tag()) {
    $post_type = get_query_var('post_type');
    if($post_type)
    $post_type = $post_type;
    else
    $post_type = array('post','event','nav_menu_item');
    $query->set('post_type',$post_type);
    return $query;
    }
    }
    ?>

    Thanks in advance,

    Jeannine

    Admin

    Syahir Hakim

    #31604

    Add this before the closing ?> in your child theme’s functions.php file:

    function graphene_custom_slider_post_type( $post_types ){
    $post_types[] = 'event';
    return $post_types;
    }
    add_filter( 'graphene_slider_post_type', 'graphene_custom_slider_post_type' );

    jmek66

    #31605

    That did it! Thanks for your usual flawless support.

    jeannine

    Admin

    Syahir Hakim

    #31606

    Marking thread as resolved. You can do this yourself as well.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.