-
AuthorPosts
-
April 10, 2015 at 3:11 pm #426609
Hi !
I have a website with the enfold theme and The Events Calendar plugin.
I figure that the thumbnail for the next event are define in the file enfold/config-templatebuilder/avia-shortcodes/events_upcoming.php function shortcode_handler().
I have a simple question. I want to change the type of thumbnail “square” by “portfolio-small” in
$image = get_the_post_thumbnail($entry->ID, 'square', array( 'class' => 'av-upcoming-event-image' ));
So in my functions.php of my child-theme I have add :
add_action( 'shortcode_handler', 'homepage_agenda' ); /** * Frontend Shortcode Handler HOMEPAGE AGENDA * * @param array $atts array of attributes * @param string $content text within enclosing form of shortcode element * @param string $shortcodename the shortcode found, when == callback name * @return string $output returns the modified html string */ function homepage_agenda($atts, $content = "", $shortcodename = "", $meta = "") { $atts = shortcode_atts(array( 'categories' => "", 'items' => "3", 'paginate' => "no", ), $atts, $this->config['shortcode']); $output = ""; $posts = $this->query_entries( $atts ); $entries= $posts->posts; if (!empty($entries)) { global $post; $default_id = $post->ID; $output .= "<div class='av-upcoming-events ".$meta['el_class']."'>"; foreach($entries as $entry) { $class = "av-upcoming-event-entry"; $image = get_the_post_thumbnail($entry->ID, 'portfolio_small', array( 'class' => 'av-upcoming-event-image' )); $class .= empty($image) ? " av-upcoming-event-with-image" : " av-upcoming-event-without-image"; $title = get_the_title($entry->ID); $link = get_permalink($entry->ID); $post->ID = $entry->ID; //temp set of the post id so that tribe fetches the correct price symbol $price = tribe_get_cost( $entry->ID, true ); $venue = tribe_get_venue( $entry->ID ); $post->ID = $default_id; $output .= "<a href='{$link}' class='{$class}'>"; if($image) $output .= $image; $output .= "<div class='av-upcoming-event-data'>"; $output .= "<h4 title='av-upcoming-event-title'>{$title}</h4>"; $output .= "<div class='av-upcoming-event-meta'>"; $output .= "<span class='av-upcoming-event-schedule'>".tribe_events_event_schedule_details($entry)."</span>"; if($price) $output .= "<span class='av-upcoming-event-cost'>{$price}</span>"; if( $price && $venue ) $output .= " - "; if($venue) $output .= "<span class='av-upcoming-event-venue'>{$venue}</span>"; $output .= apply_filters('avf_upcoming_event_extra_data', "", $entry); $output .= "</div>"; $output .= "</div>"; $output .= "</a>"; } if($atts['paginate'] == "yes" && $avia_pagination = avia_pagination($posts->max_num_pages, 'nav')) { $output .= "<div class='pagination-wrap pagination-".TribeEvents::POSTTYPE."'>{$avia_pagination}</div>"; } $output .= "</div>"; } return $output; }
Is that correct ? The thumbnail stay in square size (180px by 180px). If i change directly in the events_upcoming.php file it’s work. But i want to do it properly.
Thanks for your help and time
Regard
April 11, 2015 at 9:35 am #426974Hi leplusweb!
Thank you for using Enfold.
Unfortunately, that is not going to work. You need to edit the file manually. You can create a child theme and modify the shortcode file there. Refer to this link: http://kriesi.at/documentation/enfold/add-new-or-replace-advanced-layout-builder-elements-from-child-theme/
Best regards,
IsmaelApril 28, 2015 at 10:58 am #435914Hi,
ok, it’s work like this. Thanks for your help, i learn a lot with your documentation.
RTFM :)
Regards
-
AuthorPosts
- The topic ‘The Events Calendar hompeage Shortcode – customize thumbnail size’ is closed to new replies.