Exemple #1
0
function wpcis_my_shortcode_head()
{
    global $posts;
    $pattern = get_shortcode_regex();
    preg_match('/(\\[(creativeslider) id="([0-9]+)"\\])/s', $posts[0]->post_content, $matches);
    if (is_array($matches) && $matches[2] == 'creativeslider') {
        $slider_id = (int) $matches[3];
        wpcis_enqueue_front_scripts($slider_id);
    }
}
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     // Before widget
     echo $before_widget;
     // Title of widget
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     // the widget content
     wpcis_enqueue_front_scripts($instance['slider_id']);
     echo $cis_rendered_content = wpcis_render_slider($instance['slider_id']);
     // After widget
     echo $after_widget;
 }