コード例 #1
0
function testimonial_rotator_shortcode($atts)
{
    return get_testimonial_rotator($atts);
}
コード例 #2
0
function testimonial_single_shortcode($atts)
{
    $id = isset($atts['id']) ? $atts['id'] : false;
    if ($id) {
        $testimonial = get_post($id);
        if ($testimonial->post_type == "testimonial") {
            // SETUP VARIABLES
            $rotator_id = get_post_meta($id, '_rotator_id', true);
            $rotator_ids = (array) testimonial_rotator_break_piped_string($rotator_id);
            $rotator_id = reset($rotator_ids);
            $atts['is_single'] = true;
            $atts['id'] = $rotator_id;
            $atts['testimonial_id'] = $id;
            $atts['prev_next'] = false;
            return get_testimonial_rotator($atts);
        } else {
            testimonial_rotator_error(__('Testimonial is not a testimonial post type', 'testimonial-rotator'));
        }
    } else {
        testimonial_rotator_error(sprintf(__('Testimonial could not be found with ID: %d', 'testimonial-rotator'), $id));
    }
}