Пример #1
0
function dt_print_widget_recent_photos($atts)
{
    extract(shortcode_atts(array('ppp' => 6, 'title' => '', 'column' => 'half', 'orderby' => 'date', 'order' => 'DESC', 'only' => '', 'except' => ''), $atts));
    $title = strip_tags($title);
    $ppp = absint($ppp);
    $order = DT_latest_photo_Widget::dt_sanitize_enum($order, DT_latest_photo_Widget::$order_reference);
    $orderby = DT_latest_photo_Widget::dt_sanitize_enum($orderby, array_keys(DT_latest_photo_Widget::$orderby_reference));
    $args = array('before_widget' => '<div class="' . esc_attr($column) . '">', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>');
    $select = 'all';
    $cats = array();
    if ($except) {
        $select = 'except';
        $cats = array_map('trim', explode(',', $except));
    }
    if ($only) {
        $select = 'only';
        $cats = array_map('trim', explode(',', $only));
    }
    $params = array('title' => $title, 'show' => $ppp, 'order' => $order, 'orderby' => $orderby, 'select' => $select);
    if ($cats) {
        $params['cats'] = $cats;
    }
    ob_start();
    the_widget('DT_latest_photo_Widget', $params, $args);
    $output = ob_get_clean();
    return $output;
}