Created
March 1, 2017 14:47
-
-
Save altuno/4804d0de6a7a2e464558aae6ab7040b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Site plugin for genevaphotoclub.com | |
Description: Site specific code for genevaphotoclub.com | |
*/ | |
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */ | |
//* Gravity forms hide labels option enable | |
add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' ); | |
/** | |
* ------------------------------------------------------------------------ | |
//* EVENT ESPRESSO MODIFICATIONS: | |
* ------------------------------------------------------------------------ | |
*/ | |
//------------------------------------------------------------------------ | |
// Add event categories to EE4 csv download | |
function ee_tw_event_categories_to_csv( $reg_csv_array, $reg_row ) { | |
$EVT_ID = $reg_row[ 'Event_CPT.ID']; | |
$terms = array(); | |
$event_categories = get_the_terms( $EVT_ID, 'espresso_event_categories' ); | |
if ( $event_categories ) { | |
foreach( $event_categories as $term ) { | |
$terms[] = $term->name; | |
} | |
$terms = implode( ', ', $terms); | |
} | |
$reg_csv_array['Event Categories'] = !empty($terms) ? $terms : null; | |
return $reg_csv_array; | |
} | |
add_filter( 'FHEE__EE_Export__report_registrations__reg_csv_array', 'ee_tw_event_categories_to_csv', 10, 2 ); | |
//* Add instructor name to EE4 CSV Download | |
add_filter( 'FHEE__EE_Export__report_registrations__reg_csv_array', 'espresso_add_author_to_report', 10, 2); | |
function espresso_add_author_to_report( $reg_csv_array, $reg_row ) { | |
$event_id = $reg_row['Registration.EVT_ID']; | |
$event = EEM_Event::instance()->get_one_by_ID( $event_id ); | |
if ( $event instanceof EE_Event ) { | |
$post_author = get_post_field( 'post_author', $event_id ); | |
$author_info = get_userdata( $post_author ); | |
$reg_csv_array['Author'] = $author_info->last_name . ", " . $author_info->first_name; | |
} | |
return $reg_csv_array; | |
} | |
//* Add language tags to the CSV Download | |
add_filter( 'FHEE__EE_Export__report_registrations__reg_csv_array', 'espresso_add_tag_to_report', 10, 2); | |
function espresso_add_tag_to_report( $reg_csv_array, $reg_row ) { | |
$event_id = $reg_row['Registration.EVT_ID']; | |
$event = EEM_Event::instance()->get_one_by_ID( $event_id ); | |
if ( $event instanceof EE_Event ) { | |
$posttags = get_the_tags( $event_id ); | |
if ($posttags) { | |
foreach($posttags as $tag) { | |
$reg_csv_array['Tag'] = $tag->name; | |
} | |
} | |
} | |
return $reg_csv_array; | |
} | |
//----------------------------------------------------------------------- | |
// Register Now button text | |
function ee_register_now_button() { | |
return 'Register · S\'inscrire'; | |
} | |
add_filter ('FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', 'ee_register_now_button'); | |
// Finalize Registration button text | |
function ee_modify_button_text( $submit_button_text, EE_Checkout $checkout ) { | |
if ( ! $checkout instanceof EE_Checkout || ! $checkout->current_step instanceof EE_SPCO_Reg_Step || ! $checkout->next_step instanceof EE_SPCO_Reg_Step ) { | |
return $submit_button_text; | |
} | |
if ( $checkout->next_step->slug() == 'finalize_registration' ) { | |
$submit_button_text = 'Finalize registration · Finaliser l\'inscription'; | |
} | |
return $submit_button_text; | |
} | |
add_filter( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_modify_button_text', 10, 2); | |
// promotion button text | |
function ee_modify_promotions_button_text() { | |
return 'Apply Discount Code · Appliquer code de rabais'; | |
} | |
add_filter( 'FHEE__EED_Promotions___add_promotions_form_inputs__ee_promotion_code_submit__default', 'ee_modify_promotions_button_text' ); | |
// Proceed to Payment Options text | |
function ee_proceed_to_button( $submit_button_text, EE_Checkout $checkout ) { | |
if ( ! $checkout instanceof EE_Checkout || ! $checkout->current_step instanceof EE_SPCO_Reg_Step || ! $checkout->next_step instanceof EE_SPCO_Reg_Step ) { | |
return $submit_button_text; | |
} | |
if ( $checkout->next_step->slug() == 'payment_options' ) { | |
$submit_button_text = 'Proceed to Payment · Procéder au Paiement'; | |
} | |
return $submit_button_text; | |
} | |
add_filter ( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_proceed_to_button', 10, 2 ); | |
// general text strings | |
function ee_general_filter_gettext( $translated, $original, $domain ) { | |
// This is an array of original strings | |
// and what they should be replaced with | |
$strings = array( | |
'Event Phone:' => 'For questions · Numero d\'appel:', | |
'Important information regarding your payment' => '', | |
'In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.' => '', | |
'Details' => '', | |
'Please Select Your Method of Payment' => 'Please Select Your Method of Payment · Merci de sélectionner votre mode de paiement', | |
'Registrations:' => 'Number of Registrations · Nombre d\'inscriptions', | |
'Name and Description' => '', | |
'Price' => 'Price · Prix', | |
'Qty' => 'Qty · Qté', | |
'Total' => 'Total', | |
'Line Item' => '', | |
'Address' => 'Address · Adresse', | |
'City' => 'City · Ville', | |
'Country' => 'Country · Pays', | |
'Zip' => 'Postal Code · Code Postale', | |
'Phone' => 'Phone · Téléphone', | |
'Pay Now' => 'Pay Now · Payer maintenant', | |
'We\'re sorry, but all ticket sales have ended.' => 'We\'re sorry, but the deadline for registrations is past. · Nous sommes désolés, mais la date limite pour les inscriptions est passée.', | |
// Add some more strings here | |
); | |
// See if the current string is in the $strings array | |
// If so, replace its translation | |
if ( isset( $strings[$original] ) ) { | |
// This accomplishes the same thing as __() | |
// but without running it through the filter again | |
$translations = get_translations_for_domain( $domain ); | |
$translated = $translations->translate( $strings[$original] ); | |
} | |
return $translated; | |
} | |
add_filter( 'gettext', 'ee_general_filter_gettext', 10, 3 ); | |
//* Disable email match forced login - EE4 WP User Integration | |
add_filter( 'EED_WP_Users_SPCO__verify_user_access__perform_email_user_match_check', 'jf_ee_wp_users_remove_email_user_match_check' ); | |
function jf_ee_wp_users_remove_email_user_match_check() { | |
if ( ! is_user_logged_in() ) { | |
return false; | |
} else { | |
return true; | |
} | |
} | |
/** | |
* ------------------------------------------------------------------------ | |
//* EVENT ESPRESSO FILTER OUT ALREADY STARTED MULTI DATETIME EVENTS: | |
* ------------------------------------------------------------------------ | |
*/ | |
/** | |
* The purpose of this snippet is to filter the event archive (and event taxonomy archive) pages so that they exclude events | |
* that have tickets no longer on sale. | |
* | |
* NOTE: This query is only valid for Event Espresso 4.8+ | |
* | |
* To Implement this code, add it to the bottom of your themes functions.php file, or add it to a site specific plugin. | |
* | |
*/ | |
function de_ee_tweak_event_list_exclude_ticket_expired_events_where( $SQL, WP_Query $wp_query ) { | |
if ( isset( $wp_query->query_vars['post_type'] ) && ( $wp_query->query_vars['post_type'] == 'espresso_events' || ( is_array( $wp_query->query_vars['post_type'] ) && in_array( 'espresso_events', $wp_query->query_vars['post_type'] ) ) ) && ! $wp_query->is_singular ) { | |
$SQL .= ' AND Ticket.TKT_end_date > "' . current_time( 'mysql', true ) . '" AND Ticket.TKT_deleted=0'; | |
} | |
return $SQL; | |
} | |
add_filter( 'posts_where', 'de_ee_tweak_event_list_exclude_ticket_expired_events_where', 15, 2 ); | |
function de_ee_tweak_event_list_exclude_ticket_expired_events_join( $SQL, $wp_query ) { | |
if ( isset( $wp_query->query_vars['post_type'] ) && ( $wp_query->query_vars['post_type'] == 'espresso_events' || ( is_array( $wp_query->query_vars['post_type'] ) && in_array( 'espresso_events', $wp_query->query_vars['post_type'] ) ) ) && ! $wp_query->is_singular ) { | |
if ( ! $wp_query->is_espresso_event_archive && ! $wp_query->is_espresso_event_taxonomy ) { | |
$SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . EEM_Event::instance()->table() . '.ID = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name() . ' ) '; | |
} | |
$SQL .= ' INNER JOIN ' . EEM_Datetime_Ticket::instance()->table() . ' AS Datetime_Ticket ON ( Datetime_Ticket.DTT_ID=' . EEM_Datetime::instance()->table() . '.' . EEM_Datetime::instance()->primary_key_name() . ' ) INNER JOIN ' . EEM_Ticket::instance()->table() . ' AS Ticket ON ( Datetime_Ticket.TKT_ID=Ticket.' . EEM_Ticket::instance()->primary_key_name() . ' ) '; | |
} | |
return $SQL; | |
} | |
add_filter( 'posts_join', 'de_ee_tweak_event_list_exclude_ticket_expired_events_join', 3, 2 ); | |
/** | |
* ------------------------------------------------------------------------ | |
//* EVENT ESPRESSO UPCOMING EVENTS WIDGET LINK UPDATE: | |
* ------------------------------------------------------------------------ | |
*/ | |
/** | |
* Event Espresso | |
* | |
* Event Registration and Management Plugin for WordPress | |
* | |
* @ package Event Espresso | |
* @ author Seth Shoultes | |
* @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. | |
* @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * | |
* @ link http://www.eventespresso.com | |
* @ version 4.0 | |
* | |
* ------------------------------------------------------------------------ | |
* | |
* Upcoming Events Widget | |
* | |
* @package Event Espresso | |
* @subpackage /widgets/upcoming_events/ | |
* @author Brent Christensen | |
* | |
* ------------------------------------------------------------------------ | |
*/ | |
class the_custom_EEW_Upcoming_Events extends WP_Widget { | |
/** | |
* Register widget with WordPress. | |
*/ | |
function __construct() { | |
parent::__construct( | |
'custom-ee-upcoming-events-widget', | |
__( 'Custom Event Espresso Upcoming Events', 'event_espresso' ), | |
array( 'description' => __( 'A custom widget to display your upcoming events.', 'event_espresso' )), | |
array( | |
'width' => 300, | |
'height' => 350, | |
'id_base' => 'custom-ee-upcoming-events-widget' | |
) | |
); | |
} | |
/** | |
* Back-end widget form. | |
* | |
* @see WP_Widget::form() | |
* @param array $instance Previously saved values from database. | |
* @return string|void | |
*/ | |
public function form( $instance ) { | |
EE_Registry::instance()->load_class( 'Question_Option', array(), FALSE, FALSE, TRUE ); | |
// Set up some default widget settings. | |
$defaults = array( | |
'title' => __('Upcoming Events', 'event_espresso'), | |
'category_name' => '', | |
'show_expired' => FALSE, | |
'show_desc' => TRUE, | |
'show_dates' => TRUE, | |
'show_everywhere' => FALSE, | |
'date_limit' => 2, | |
'limit' => 10, | |
'date_range' => FALSE, | |
'image_size' => 'medium' | |
); | |
$instance = wp_parse_args( (array) $instance, $defaults ); | |
// don't add HTML labels for EE_Form_Fields generated inputs | |
add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); | |
$yes_no_values = array( | |
EE_Question_Option::new_instance( array( 'QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), | |
EE_Question_Option::new_instance( array( 'QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))) | |
); | |
?> | |
<!-- Widget Title: Text Input --> | |
<p> | |
<label for="<?php echo $this->get_field_id('title'); ?>"> | |
<?php _e('Title:', 'event_espresso'); ?> | |
</label> | |
<input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" type="text" /> | |
</p> | |
<p> | |
<label for="<?php echo $this->get_field_id('category_name'); ?>"> | |
<?php _e('Event Category:', 'event_espresso'); ?> | |
</label> | |
<?php | |
$event_categories = array(); | |
/** @type EEM_Term $EEM_Term */ | |
$EEM_Term = EE_Registry::instance()->load_model( 'Term' ); | |
$categories = $EEM_Term->get_all_ee_categories( TRUE ); | |
if ( $categories ) { | |
foreach ( $categories as $category ) { | |
if ( $category instanceof EE_Term ) { | |
$event_categories[] = EE_Question_Option::new_instance( array( 'QSO_value' => $category->get( 'slug' ), 'QSO_desc' => $category->get( 'name' ))); | |
} | |
} | |
} | |
array_unshift( $event_categories, EE_Question_Option::new_instance( array( 'QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso')))); | |
echo EEH_Form_Fields::select( | |
__('Event Category:', 'event_espresso'), | |
$instance['category_name'], | |
$event_categories, | |
$this->get_field_name('category_name'), | |
$this->get_field_id('category_name') | |
); | |
?> | |
</p> | |
<p> | |
<label for="<?php echo $this->get_field_id('limit'); ?>"> | |
<?php _e('Number of Events to Display:', 'event_espresso'); ?> | |
</label> | |
<input id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" value="<?php echo $instance['limit']; ?>" size="3" type="text" /> | |
</p> | |
<p> | |
<label for="<?php echo $this->get_field_id('show_expired'); ?>"> | |
<?php _e('Show Expired Events:', 'event_espresso'); ?> | |
</label> | |
<?php | |
echo EEH_Form_Fields::select( | |
__('Show Expired Events:', 'event_espresso'), | |
$instance['show_expired'], | |
$yes_no_values, | |
$this->get_field_name('show_expired'), | |
$this->get_field_id('show_expired') | |
); | |
?> | |
</p> | |
<p> | |
<label for="<?php echo $this->get_field_id('image_size'); ?>"> | |
<?php _e('Image Size:', 'event_espresso'); ?> | |
</label> | |
<?php | |
$image_sizes = array(); | |
$sizes = get_intermediate_image_sizes(); | |
if ( $sizes ) { | |
// loop thru images and create option objects out of them | |
foreach ( $sizes as $image_size ) { | |
$image_size = trim( $image_size ); | |
// no big images plz | |
if ( ! in_array( $image_size, array( 'large', 'post-thumbnail' ))) { | |
$image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => $image_size, 'QSO_desc' => $image_size )); | |
} | |
} | |
$image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso') )); | |
} | |
echo EEH_Form_Fields::select( | |
__('Image Size:', 'event_espresso'), | |
$instance['image_size'], | |
$image_sizes, | |
$this->get_field_name('image_size'), | |
$this->get_field_id('image_size') | |
); | |
?> | |
</p> | |
<p> | |
<label for="<?php echo $this->get_field_id('show_desc'); ?>"> | |
<?php _e('Show Description:', 'event_espresso'); ?> | |
</label> | |
<?php | |
echo EEH_Form_Fields::select( | |
__('Show Description:', 'event_espresso'), | |
$instance['show_desc'], | |
$yes_no_values, | |
$this->get_field_name('show_desc'), | |
$this->get_field_id('show_desc') | |
); | |
?> | |
</p> | |
<p> | |
<label for="<?php echo $this->get_field_id('show_dates'); ?>"> | |
<?php _e('Show Dates:', 'event_espresso'); ?> | |
</label> | |
<?php | |
echo EEH_Form_Fields::select( | |
__('Show Dates:', 'event_espresso'), | |
$instance['show_dates'], | |
$yes_no_values, | |
$this->get_field_name('show_dates'), | |
$this->get_field_id('show_dates') | |
); | |
?> | |
</p> | |
<p> | |
<label for="<?php echo $this->get_field_id('show_everywhere'); ?>"> | |
<?php _e('Show on all Pages:', 'event_espresso'); ?> | |
</label> | |
<?php | |
echo EEH_Form_Fields::select( | |
__('Show on all Pages:', 'event_espresso'), | |
$instance['show_everywhere'], | |
$yes_no_values, | |
$this->get_field_name('show_everywhere'), | |
$this->get_field_id('show_everywhere') | |
); | |
?> | |
</p> | |
<p> | |
<label for="<?php echo $this->get_field_id('date_limit'); ?>"> | |
<?php _e('Number of Dates to Display:', 'event_espresso'); ?> | |
</label> | |
<input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr( $instance['date_limit'] ); ?>" size="3" type="text" /> | |
</p> | |
<p> | |
<label for="<?php echo $this->get_field_id('date_range'); ?>"> | |
<?php _e('Show Date Range:', 'event_espresso'); ?> | |
</label> | |
<?php | |
echo EEH_Form_Fields::select( | |
__('Show Date Range:', 'event_espresso'), | |
$instance['date_range'], | |
$yes_no_values, | |
$this->get_field_name('date_range'), | |
$this->get_field_id('date_range') | |
); | |
?><span class="description"><br /><?php _e('This setting will replace the list of dates in the widget.', 'event_espresso'); ?></span> | |
</p> | |
<?php | |
} | |
/** | |
* Sanitize widget form values as they are saved. | |
* | |
* @see WP_Widget::update() | |
* | |
* @param array $new_instance Values just sent to be saved. | |
* @param array $old_instance Previously saved values from database. | |
* | |
* @return array Updated safe values to be saved. | |
*/ | |
public function update( $new_instance, $old_instance ) { | |
$instance = $old_instance; | |
$instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; | |
$instance['category_name'] = $new_instance['category_name']; | |
$instance['show_expired'] = $new_instance['show_expired']; | |
$instance['limit'] = $new_instance['limit']; | |
$instance['image_size'] = $new_instance['image_size']; | |
$instance['show_desc'] = $new_instance['show_desc']; | |
$instance['show_dates'] = $new_instance['show_dates']; | |
$instance['show_everywhere'] = $new_instance['show_everywhere']; | |
$instance['date_limit'] = $new_instance['date_limit']; | |
$instance['date_range'] = $new_instance['date_range']; | |
return $instance; | |
} | |
/** | |
* Front-end display of widget. | |
* | |
* @see WP_Widget::widget() | |
* | |
* @param array $args Widget arguments. | |
* @param array $instance Saved values from database. | |
*/ | |
public function widget( $args, $instance ) { | |
global $post; | |
// make sure there is some kinda post object | |
if ( $post instanceof WP_Post ) { | |
$before_widget = ''; | |
$before_title = ''; | |
$after_title = ''; | |
$after_widget = ''; | |
// but NOT an events archives page, cuz that would be like two event lists on the same page | |
$show_everywhere = isset( $instance['show_everywhere'] ) ? (bool) absint( $instance['show_everywhere'] ) : TRUE; | |
if ( $show_everywhere || ! ( $post->post_type == 'espresso_events' && is_archive() )) { | |
// let's use some of the event helper functions' | |
// make separate vars out of attributes | |
extract($args); | |
// add function to make the title a link | |
add_filter('widget_title', array($this, 'make_the_title_a_link'), 15); | |
// filter the title | |
$title = apply_filters('widget_title', $instance['title']); | |
// remove the function from the filter, so it does not affect other widgets | |
remove_filter('widget_title', array($this, 'make_the_title_a_link'), 15); | |
// Before widget (defined by themes). | |
echo $before_widget; | |
// Display the widget title if one was input (before and after defined by themes). | |
if ( ! empty( $title )) { | |
echo $before_title . $title . $after_title; | |
} | |
// grab widget settings | |
$category = isset( $instance['category_name'] ) && ! empty( $instance['category_name'] ) ? $instance['category_name'] : FALSE; | |
$show_expired = isset( $instance['show_expired'] ) ? (bool) absint( $instance['show_expired'] ) : FALSE; | |
$image_size = isset( $instance['image_size'] ) && ! empty( $instance['image_size'] ) ? $instance['image_size'] : 'medium'; | |
$show_desc = isset( $instance['show_desc'] ) ? (bool) absint( $instance['show_desc'] ) : TRUE; | |
$show_dates = isset( $instance['show_dates'] ) ? (bool) absint( $instance['show_dates'] ) : TRUE; | |
$date_limit = isset( $instance['date_limit'] ) && ! empty( $instance['date_limit'] ) ? $instance['date_limit'] : NULL; | |
$date_range = isset( $instance['date_range'] ) && ! empty( $instance['date_range'] ) ? $instance['date_range'] : FALSE; | |
// start to build our where clause | |
$where = array( | |
// 'Datetime.DTT_is_primary' => 1, | |
'status' => 'publish' | |
); | |
// add category | |
if ( $category ) { | |
$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; | |
$where['Term_Taxonomy.Term.slug'] = $category; | |
} | |
// if NOT expired then we want events that start today or in the future | |
if ( ! $show_expired ) { | |
$where['Datetime.DTT_EVT_end'] = array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ); | |
} | |
// run the query | |
$events = EE_Registry::instance()->load_model( 'Event' )->get_all( array( | |
$where, | |
'limit' => $instance['limit'] > 0 ? '0,' . $instance['limit'] : '0,10', | |
'order_by' => 'Datetime.DTT_EVT_start', | |
'order' => 'ASC', | |
'group_by' => 'EVT_ID' | |
)); | |
if ( ! empty( $events )) { | |
echo '<ul class="ee-upcoming-events-widget-ul">'; | |
foreach ( $events as $event ) { | |
if ( $event instanceof EE_Event && ( !is_single() || $post->ID != $event->ID() ) ) { | |
//printr( $event, '$event <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); | |
echo '<li id="ee-upcoming-events-widget-li-' . $event->ID() . '" class="ee-upcoming-events-widget-li">'; | |
// how big is the event name ? | |
$name_length = strlen( $event->name() ); | |
switch( $name_length ) { | |
case $name_length > 70 : | |
$len_class = ' three-line'; | |
break; | |
case $name_length > 35 : | |
$len_class = ' two-line'; | |
break; | |
default : | |
$len_class = ' one-line'; | |
} | |
$event_url = apply_filters( 'FHEE_EEW_Upcoming_Events__widget__event_url', $event->get_permalink(), $event ); | |
echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a' . $len_class . '" href="' . $event_url . '">' . $event->name() . '</a></h5>'; | |
if ( post_password_required( $event->ID() ) ) { | |
$pswd_form = apply_filters( 'FHEE_EEW_Upcoming_Events__widget__password_form', get_the_password_form( $event->ID() ), $event ); | |
echo $pswd_form; | |
} else { | |
if ( has_post_thumbnail( $event->ID() ) && $image_size != 'none' ) { | |
echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="' . $event_url . '">' . get_the_post_thumbnail( $event->ID(), $image_size ) . '</a></div>'; | |
} | |
$desc = $event->short_description( 25 ); | |
if ( $show_dates ) { | |
$date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', get_option( 'date_format' )); | |
$time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', get_option( 'time_format' )); | |
$single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', get_option( 'date_format' )); | |
$single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' )); | |
if ( $date_range == TRUE ) { | |
echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() ); | |
}else{ | |
echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit ); | |
} | |
} | |
if ( $show_desc && $desc ) { | |
echo '<p style="margin-top: .5em">' . $desc . '</p>'; | |
} | |
} | |
echo '</li>'; | |
} | |
} | |
echo '</ul>'; | |
} | |
// After widget (defined by themes). | |
echo $after_widget; | |
} | |
} | |
} | |
/** | |
* make_the_title_a_link | |
* callback for widget_title filter | |
* | |
* @param $title | |
* @return string | |
*/ | |
public function make_the_title_a_link($title) { | |
return '<a href="https://www.genevaphotoclub.com/dates-prices/">' . $title . '</a>'; | |
} | |
} | |
// End of file EEW_Upcoming_Events.widget.php | |
// Location: /widgets/upcoming_events/EEW_Upcoming_Events.widget.php | |
// Register and load the widget | |
function my_load_customEE_widget() { | |
register_widget( 'the_custom_EEW_Upcoming_Events' ); | |
} | |
add_action( 'widgets_init', 'my_load_customEE_widget' ); | |
/* Stop Adding Functions */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment