public function get_event_hash_code()
 {
     $start_date = pronamic_get_the_start_date('U', $this->post->ID);
     $end_date = pronamic_get_the_end_date('U', $this->post->ID);
     $hash_code = '' . $start_date . '-' . $end_date;
     return $hash_code;
 }
<?php

global $pronamic_events_plugin, $post;
if (pronamic_has_start_date()) {
    $start_date = pronamic_get_the_start_date('d-m-Y');
    $start_time = pronamic_get_the_start_date('H:i');
} else {
    $start_date = '';
    $start_time = '';
}
$end_timestamp = get_post_meta($post->ID, '_pronamic_end_date', true);
if (pronamic_has_end_date()) {
    $end_date = pronamic_get_the_end_date('d-m-Y');
    $end_time = pronamic_get_the_end_date('H:i');
} else {
    $end_date = $start_date;
    $end_time = $start_time;
}
?>

<table class="form-table">
	<tbody>
		<tr>
			<th scope="row">
				<label for="pronamic_start_date"><?php 
_e('Start Date', 'pronamic_events');
?>
</label>
			</th>
			<td>
				<input class="pronamic_date" type="text" id="pronamic_start_date" name="pronamic_start_date" value="<?php 
 /**
  * Manage posts custom column
  *
  * @param string $column_name
  * @param string $post_id
  */
 public function manage_posts_custom_column($column_name, $post_id)
 {
     $post = get_post($post_id);
     switch ($column_name) {
         case 'pronamic_start_date':
             // @see http://translate.wordpress.org/projects/wp/3.5.x/admin/nl/default?filters[term]=Y%2Fm%2Fd&filters[user_login]=&filters[status]=current_or_waiting_or_fuzzy_or_untranslated&filter=Filter&sort[by]=priority&sort[how]=desc
             // @see https://github.com/WordPress/WordPress/blob/3.5.1/wp-admin/includes/class-wp-posts-list-table.php#L572
             $t_time = pronamic_get_the_start_date(__('Y/m/d g:i:s A', 'pronamic_events'), $post_id);
             $h_time = pronamic_get_the_start_date(__('Y/m/d', 'pronamic_events'), $post_id);
             $hours = pronamic_get_the_start_date(__('g:i:s', 'pronamic_events'), $post_id);
             printf('<abbr title="%s">%s</abbr><br />%s', $t_time, $h_time, $hours);
             break;
         case 'pronamic_end_date':
             // @see http://translate.wordpress.org/projects/wp/3.5.x/admin/nl/default?filters[term]=Y%2Fm%2Fd&filters[user_login]=&filters[status]=current_or_waiting_or_fuzzy_or_untranslated&filter=Filter&sort[by]=priority&sort[how]=desc
             // @see https://github.com/WordPress/WordPress/blob/3.5.1/wp-admin/includes/class-wp-posts-list-table.php#L572
             $t_time = pronamic_get_the_end_date(__('Y/m/d g:i:s A', 'pronamic_events'), $post_id);
             $h_time = pronamic_get_the_end_date(__('Y/m/d', 'pronamic_events'), $post_id);
             $hours = pronamic_get_the_end_date(__('g:i:s', 'pronamic_events'), $post_id);
             printf('<abbr title="%s">%s</abbr><br />%s', $t_time, $h_time, $hours);
             break;
         case 'pronamic_event_repeat':
             $repeat = get_post_meta($post_id, '_pronamic_event_repeat', true);
             if ($repeat || $post->post_parent) {
                 echo '<span class="dashicons dashicons-backup" />';
             }
             break;
         default:
     }
 }
Пример #4
0
/**
 * Echo formatted start date
 * 
 * @return echo the start date
 */
function pronamic_the_start_date($format = null, $post_id = null)
{
    echo pronamic_get_the_start_date($format, $post_id);
}
			<?php 
    foreach ($repeat_events as $repeat_event) {
        ?>

				<tr>
					<td>
						<?php 
        edit_post_link(get_the_title($repeat_event->post), null, null, $repeat_event->post->ID);
        ?>
					</td>
					<td>
						<?php 
        $t_time = pronamic_get_the_start_date(__('Y/m/d g:i:s A', 'pronamic_events'), $repeat_event->post->ID);
        $h_time = pronamic_get_the_start_date(__('Y/m/d', 'pronamic_events'), $repeat_event->post->ID);
        $hours = pronamic_get_the_start_date(__('g:i:s', 'pronamic_events'), $repeat_event->post->ID);
        printf('<abbr title="%s">%s</abbr><br />%s', $t_time, $h_time, $hours);
        ?>
					</td>
					<td>
						<?php 
        $t_time = pronamic_get_the_end_date(__('Y/m/d g:i:s A', 'pronamic_events'), $repeat_event->post->ID);
        $h_time = pronamic_get_the_end_date(__('Y/m/d', 'pronamic_events'), $repeat_event->post->ID);
        $hours = pronamic_get_the_end_date(__('g:i:s', 'pronamic_events'), $repeat_event->post->ID);
        printf('<abbr title="%s">%s</abbr><br />%s', $t_time, $h_time, $hours);
        ?>
					</td>
					<td>
						<?php 
        $hash_key = $repeat_event->get_event_hash_code();
        echo isset($data[$hash_key]) ? __('Yes', 'pronamic_events') : __('No', 'pronamic_events');