Beispiel #1
0
 function widget($args, $instance)
 {
     extract($args);
     echo $before_widget;
     $title = apply_filters('widget_title', $instance['title']);
     if (!empty($title)) {
         echo $before_title . sanitize_text_field($title) . $after_title;
     }
     $args = array('ids' => array_map('absint', (array) $instance['ids']));
     echo tdd_pb_get_bars($args);
     echo $instance['desc'] ? wpautop(esc_html($instance['desc'])) : '';
     echo $after_widget;
 }
function tdd_pb_shortcode($args)
{
    $args = shortcode_atts(array('id' => '', 'ids' => '', 'width' => 'auto', 'class' => '', 'height' => ''), $args);
    //explode "id" and "ids" on their commas separately, then merge the arrays together
    $idarr = explode(',', $args['id']);
    $idsarr = explode(',', $args['ids']);
    $idsarr = array_merge($idarr, $idsarr);
    //Request some bars
    $return = tdd_pb_get_bars(array('ids' => $idsarr, 'width' => $args['width'], 'class' => $args['class'], 'height' => $args['height']));
    //Return them bars
    return $return;
}
Beispiel #3
0
function tdd_pb_custom_columns($column)
{
    global $post;
    switch ($column) {
        case 'progress_bar':
            echo tdd_pb_get_bars(array('ids' => array($post->ID), 'class' => 'tdd_pb_race', 'height' => '25px'));
            break;
        case 'shortcode':
            echo '<code>[progress id=' . $post->ID . ']</code>';
            break;
    }
}