To insert code use <code>...</code>.
Events Calendar Plugin - Show event custom post type in slideshow
  • Hi Kaptinlin.
    I'm desperately trying to find a plugin for events. I finally came up with "The Events Calendar". As you may know, the plugin creates custom post types for events. Now I'm trying to figure out how to show them in the slideshow shortcode. I followed a guide you made here: http://kaptinlin.com/support/discussion/3540/custom-post-type-in-slideshow/p1. Nevertheless, I cannot make it work. Here is the code I made:


    In OptionsGenerator.php

    $options['Events']['e'] = '(e) All';
    $entries = get_terms('tribe_events_cat','orderby=name&hide_empty=0&suppress_filters=0');
    foreach($entries as $key => $entry) {
    $options['Events']['e|'.$entry->slug] = '(e) '.$entry->name;
    }


    In themegenerator.php


    if(array_key_exists('e',$source)){
    $query = array(
    'post_type' => 'tribe_events',
    'showposts'=>$number,
    'orderby'=>'menu_order',
    'order'=>'ASC',
    );
    if(!empty($source['e'])){
    global $wp_version;
    if(version_compare($wp_version, "3.1", '>=')){
    $query['tax_query'] = array(
    array(
    'taxonomy' => 'tribe_events_cat',
    'field' => 'slug',
    'terms' => explode(',', $source['e'])
    )
    );
    }else{
    $query['taxonomy'] = 'tribe_events_cat';
    $query['term'] = $source['e'];
    }
    }


    $loop = new WP_Query($query);

    while ( $loop->have_posts() ) : $loop->the_post();
    $image_id = get_post_thumbnail_id();
    $image_url = wp_get_attachment_image_src($image_id,$size, true);
    $images[] = array(
    'id' => get_the_ID(),
    'title' => get_the_title(),
    'desc' => get_the_excerpt(),
    'src' => $image_url[0],
    'link' => get_permalink(),
    'target' => '_self'
    );
    endwhile;
    }



    I can see and select the event categories when creating the shortcode, but I cannot get the slideshow to show the featured image and link to event. Surely I'm missing something. Any ideas?
  • 5 Comments sorted by
  • Hi marisap ,

    The code seems fine. If you can provide your ftp and your wordpress login, i will help you make it works.

    My email is kaptinlin@gmail.com

    Regards,
    Kaptinlin
  • Thanks Kaptinlin! I'm sending you an email right away. Regards.
  • Hi marisap,
    You can edit on striking/framework/helpers/themeGenerator.php

    Locate line 860.

    change
    $pattern = '/{([sbpg]):{0,1}([^}]+?){0,1}}/i';

    To

    $pattern = '/{([sbpge]):{0,1}([^}]+?){0,1}}/i';

    Regards,
    Kaptinlin

  • Hi Kaptinlin. After the striking theme update, the code has changed and I can't seem to get this to work anymore. Can you help me?
  • Hi

    the code is now at line 1026.

    Best regards,
    Striking Team
    Paul