Last active
August 4, 2017 13:29
-
-
Save jmslbam/ebd523793e14787ecb957691ae79c9e2 to your computer and use it in GitHub Desktop.
Clarkson Event Manager - WordPress Object overwrite example
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 | |
use Clarkson\EventManager\Event; | |
// Which class do we need to initiate? new \XYZ? | |
add_filter('clarkson_event_manager_post_class', function(){ | |
return '\Clarkson_Event'; | |
}, 10, 0); | |
// Our custom WordPress object | |
class Clarkson_Event extends Event { | |
public function get_event_date($format = ''){ | |
return '<time class="updated" datetime="'. $this->getDateTime( $this->data['clarkson_event_manager_date_start'], $this->data['clarkson_event_manager_date_start_time'] )->format('c') .'">' . $this->getDateTime( $this->data['clarkson_event_manager_date_start'], $this->data['clarkson_event_manager_date_start_time'] )->format( get_option( 'date_format' ) ).'</time>'; | |
} | |
public function get_event_date_start_format( $format ){ | |
$date = $this->getDateTime( $this->data['clarkson_event_manager_date_start'], $this->data['clarkson_event_manager_date_start_time'] ); | |
return ( $date ) ? $date->format( $format ) : ''; | |
} | |
public function get_event_date_start_time( $format ){ | |
$date = $this->getDateTime( $this->data['clarkson_event_manager_date_start'], $this->data['clarkson_event_manager_date_start_time'] ); | |
return ( $date ) ? $date->format( $format ) : ''; | |
} | |
public function get_event_date_end_format( $format ){ | |
$date = $this->getDateTime( $this->data['clarkson_event_manager_date_end'], $this->data['clarkson_event_manager_date_end_time'] ); | |
return ( $date ) ? $date->format( $format ) : ''; | |
} | |
public function get_event_date_end_time($format){ | |
$date = $this->getDateTime( $this->data['clarkson_event_manager_date_end'], $this->data['clarkson_event_manager_date_end_time'] ); | |
return ( $date ) ? $date->format( $format ) : ''; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment