Пример #1
0
							<dt><?php 
    _e('Project', 'orbis');
    ?>
</dt>
							<dd><?php 
    orbis_task_project();
    ?>
</dd>

							<dt><?php 
    _e('Assignee', 'orbis');
    ?>
</dt>
							<dd><?php 
    orbis_task_assignee();
    ?>
</dd>

							<dt><?php 
    _e('Deadline', 'orbis');
    ?>
</dt>
							<dd><?php 
    orbis_task_due_at();
    ?>
</dd>

							<dt><?php 
    _e('Actions', 'orbis');
    ?>
Пример #2
0
/**
 * Project column
 *
 * @param string $column
 */
function orbis_task_column($column, $post_id)
{
    switch ($column) {
        case 'orbis_task_project':
            $id = get_post_meta($post_id, '_orbis_task_project_id', true);
            global $post;
            if (isset($post->project_post_id)) {
                $url = get_permalink($post->project_post_id);
                $title = get_the_title($post->project_post_id);
                printf('<a href="%s" target="_blank">%s</a>', esc_attr($url), esc_attr($title));
            } else {
                echo '&mdash;';
            }
            break;
        case 'orbis_task_assignee':
            orbis_task_assignee();
            break;
        case 'orbis_task_due_at':
            $due_at = get_post_meta($post_id, '_orbis_task_due_at', true);
            if (empty($due_at)) {
                echo '&mdash;';
            } else {
                $seconds = strtotime($due_at);
                $delta = $seconds - time();
                $days = round($delta / (3600 * 24));
                echo $due_at, '<br />';
                printf(__('%d days', 'orbis_tasks'), $days);
            }
            break;
        case 'orbis_task_time':
            $seconds = get_post_meta($post_id, '_orbis_task_seconds', true);
            if (empty($seconds)) {
                echo '&mdash;';
            } else {
                echo orbis_time($seconds);
            }
            break;
        case 'orbis_task_completed':
            $completed = get_post_meta($post_id, '_orbis_task_completed', true);
            echo $completed ? __('Yes', 'orbis_tasks') : __('No', 'orbis_tasks');
            break;
    }
}