Exemplo n.º 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;
}
 /**
  * Ausgabe eines Windgets
  *
  * Gibt per Shortcode ein Widget aus. Wenn das Widget parameter auswertet,
  * koennen diese uebergeben werden. Um z.B. das Kalender Widget mit "Hello, World!" als
  * Titel per Shortcode aufzurufen ist folgender Aufruf  noetig.
  * <code>
  * [widget name="Kalender" instance="title=Hello,World!"]
  * [widget classname="Calendar" instance="title=Hello,World!"]
  * </code>
  *
  * @param array $atts
  * @return string
  */
 public static function WidgetShortcode(array $atts)
 {
     global $wp_registered_widgets;
     $back = '';
     $widget_class = '';
     extract(shortcode_atts(array('name' => '', 'instance' => '', 'classname' => ''), $atts));
     $instance = html_entity_decode($instance);
     if ($name != '') {
         // Nun den Klassennamen des Widgets ermitteln, die Funktion the_widget erwartet den
         // Klassennamen des Widgets als Parameter.
         foreach ($wp_registered_widgets as $widget) {
             if ($widget['name'] == $name) {
                 $widget_class = get_class($widget['callback'][0]);
                 continue;
             }
         }
     } elseif ($classname != '') {
         foreach ($wp_registered_widgets as $widget) {
             if (get_class($widget['callback'][0]) == $classname) {
                 $widget_class = $classname;
                 continue;
             }
         }
     }
     if ($widget_class != '') {
         $back = "<div id='" . str_replace(" ", "_", $name) . "' class='widget_shortcode'>";
         ob_start();
         the_widget($widget_class, $instance);
         $back .= ob_get_contents();
         ob_end_clean();
         $back .= "</div>";
     }
     return $back;
 }
Exemplo n.º 3
0
 /**
  * Get Postmatic subscribe widget.
  *
  * @since 0.0.5
  *
  * @return string
  */
 public static function postmatic_widget()
 {
     $attributes = array('title' => __('Subscribe to Comments Via Email', 'epoch'), 'collect_name' => true, 'template_path' => null);
     ob_start();
     the_widget('Prompt_Subscribe_Widget', $attributes);
     return ob_get_clean();
 }
Exemplo n.º 4
0
/**
 * Go through all the old PB widgets and change them into far better visual editor widgets
 *
 * @param array $panels_data
 *
 * @return array
 */
function siteorigin_panels_legacy_widget_migration($panels_data)
{
    if (!empty($panels_data['widgets']) && is_array($panels_data['widgets'])) {
        foreach ($panels_data['widgets'] as &$widget) {
            switch ($widget['panels_info']['class']) {
                case 'SiteOrigin_Panels_Widgets_Gallery':
                    $shortcode = '[gallery ';
                    if (!empty($widget['ids'])) {
                        $shortcode .= 'ids="' . esc_attr($widget['ids']) . '" ';
                    }
                    $shortcode = trim($shortcode) . ']';
                    $widget = array('title' => '', 'filter' => '1', 'type' => 'visual', 'text' => $shortcode, 'panels_info' => $widget['panels_info']);
                    $widget['panels_info']['class'] = 'SiteOrigin_Widget_Editor_Widget';
                    break;
                case 'SiteOrigin_Panels_Widgets_Image':
                    if (class_exists('SiteOrigin_Panels_Widgets_Image')) {
                        ob_start();
                        the_widget('SiteOrigin_Panels_Widgets_Image', $widget, array('before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => ''));
                        $widget = array('title' => '', 'filter' => '1', 'type' => 'visual', 'text' => ob_get_clean(), 'panels_info' => $widget['panels_info']);
                        $widget['panels_info']['class'] = 'SiteOrigin_Widget_Editor_Widget';
                    }
                    break;
            }
        }
    }
    return $panels_data;
}
Exemplo n.º 5
0
 public static function displayWidget($instance = [], array $params = [])
 {
     if (is_string($instance)) {
         $instance = json_decode($instance, true);
     }
     if (!isset($instance['type']) || $instance['type'] !== 'widget' || !isset($instance['widget']) || !isset($instance['options'])) {
         return null;
     }
     $options = $instance['options'];
     $widgetClass = static::getWidgetClass($instance['widget']);
     if (!$widgetClass) {
         return '';
     }
     $id = static::displayWidgetId(true);
     $args = static::getWidgetChrome($widgetClass, $params['chrome']);
     ob_start();
     \the_widget($widgetClass, $options['widget'], $args);
     $html = ob_get_clean();
     if (trim($html)) {
         /** @var Theme $theme */
         $theme = static::gantry()['theme'];
         $theme->wordpress(true);
     }
     return $html;
 }
Exemplo n.º 6
0
    function storefront_header_cart()
    {
        if (is_woocommerce_activated()) {
            if (is_cart()) {
                $class = 'current-menu-item';
            } else {
                $class = '';
            }
            ?>
            <ul class="site-header-cart menu">
                <li class="<?php 
            echo esc_attr($class);
            ?>
">
                    <?php 
            storefront_cart_link();
            ?>
                </li>
                <li>
                    <?php 
            the_widget('WC_Widget_Cart', 'title=');
            ?>
                </li>
            </ul>
            <?php 
        }
    }
    function storefront_header_cart()
    {
        if (is_woocommerce_activated()) {
            if (is_cart()) {
                $class = 'current-menu-item';
            } else {
                $class = '';
            }
            ?>
		<ul class="site-header-cart menu">
			<li class="<?php 
            echo esc_attr($class);
            ?>
">
				<?php 
            storefront_cart_link();
            ?>
			</li>
			<li>
				<?php 
            the_widget('WC_Widget_Cart', 'title=');
            ?>
			</li>
		</ul>
		<div class="social-icons">
			<a href="http://instagram.com/homeboyadvance" class="icon-instagram" target="_blank"></a>
			<a href="http://facebook.com/homeboyadvance" class="icon-facebook" target="_blank"></a>
			<a href="http://twitter.com/homeboyadvance" class="icon-twitter" target="_blank"></a>
		</div>
		<?php 
        }
    }
function sandwich_jetpack_subscriptions_widget_shortcode($attr, $content)
{
    if (!class_exists('Jetpack_Subscriptions_Widget')) {
        return '';
    }
    $attr = wp_parse_args($attr, array('title' => __('Display WordPress Posts', 'jetpack'), 'subscribe_text' => __('Enter your email address to subscribe to this blog and receive notifications of new posts by email.', 'jetpack'), 'subscribe_logged_in' => __('Click to subscribe to this blog and receive notifications of new posts by email.', 'jetpack'), 'subscribe_placeholder' => __('Email Address', 'jetpack'), 'subscribe_button' => __('Subscribe', 'jetpack'), 'show_subscribers_total' => false, 'hide_title' => false));
    $attr['show_subscribers_total'] = $attr['show_subscribers_total'] === 'true' || $attr['show_subscribers_total'] === true ? true : false;
    $hideTitleClass = '';
    if ($attr['hide_title']) {
        $hideTitleClass = 'hide_title';
    }
    ob_start();
    ?>
	<div class="sandwich <?php 
    echo $hideTitleClass;
    ?>
">
		<?php 
    the_widget('Jetpack_Subscriptions_Widget', $attr);
    ?>
	</div>
	
	<?php 
    return ob_get_clean();
}
Exemplo n.º 9
0
/**
 * @shortcode hw_widget_content shortcode to display any widget content
 * @param $prop
 * @param $content
 */
function _hw_awc_feature_widget_content_shortcode($prop, $content)
{
    $args = array('widget' => '', 'sidebar' => '', 'params_config' => '', 'skin' => 'skin_default');
    $d = shortcode_atts($args, $prop);
    extract($d);
    //valid
    if (empty($widget)) {
        return;
    }
    global $wp_registered_sidebars;
    global $wp_registered_widgets;
    //default sidebar params
    $sidebar_params = array('before_title' => '', 'after_title' => '', 'before_widget' => '', 'after_widget' => '');
    if (!empty($sidebar) && !empty($skin) && isset($wp_registered_sidebars[$sidebar])) {
        $sidebar_params = HW_AWC::apply_sidebar_skin($sidebar, $skin, array('widget_id' => 'hw-shortcode-widget', 'classname' => strtolower($widget) . ' hw-awc-override'));
    }
    //get widget instance by saved widget config
    if (!empty($params_config) && is_numeric($params_config)) {
        $config = AWC_WidgetFeature_saveconfig::get_widget_setting($params_config);
        if ($config) {
            $widget_params = AWC_WidgetFeature_saveconfig::decode_config($config->setting);
        }
    }
    if (isset($widget) && class_exists($widget, false) && !empty($widget_params)) {
        //display widget content
        the_widget($widget, $widget_params, $sidebar_params);
    }
}
Exemplo n.º 10
0
function ufandshands_widget_shortcode($atts)
{
    global $wp_widget_factory;
    extract(shortcode_atts(array('widget_name' => FALSE, 'title' => '', 'numberofposts' => '3', 'showexcerpt' => 1, 'showthumbnails' => 1, 'showdate' => 1, 'showrssicon' => 1, 'specific_category_id' => ''), $atts));
    $widget_name = wp_specialchars($widget_name);
    if (!is_a($wp_widget_factory->widgets[$widget_name], 'WP_Widget')) {
        $wp_class = 'WP_Widget_' . ucwords(strtolower($class));
        if (!is_a($wp_widget_factory->widgets[$wp_class], 'WP_Widget')) {
            return '<p>' . sprintf(__("%s: Widget class not found. Make sure this widget exists and the class name is correct"), '<strong>' . $class . '</strong>') . '</p>';
        } else {
            $class = $wp_class;
        }
    }
    $instance = '&title=' . $title;
    $instance .= '&numberofposts=' . $numberofposts;
    $instance .= '&showexcerpt=' . $showexcerpt;
    $instance .= '&showthumbnails=' . $showthumbnails;
    $instance .= '&showdate=' . $showdate;
    $instance .= '&showrssicon=' . $showrssicon;
    $instance .= '&specific_category_id=' . $specific_category_id;
    // $instance .= '&='.$;
    ob_start();
    the_widget($widget_name, $instance, array('widget_id' => 'arbitrary-instance-' . $id, 'before_widget' => '<div class="widget_body">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Exemplo n.º 11
0
/**
 * Displays a widget
 *
 * @param mixed args
 * @since 0.2
 * @return string widget output
 */
function do_widget($args)
{
    global $_wp_sidebars_widgets, $wp_registered_widgets, $wp_registered_sidebars;
    extract(shortcode_atts(array('id' => '', 'title' => true, 'before_widget' => '', 'before_title' => '', 'after_title' => '', 'after_widget' => ''), $args));
    if (empty($id) || !isset($wp_registered_widgets[$id])) {
        return;
    }
    // get the widget instance options
    preg_match('/(\\d+)/', $id, $number);
    $options = get_option($wp_registered_widgets[$id]['callback'][0]->option_name);
    $instance = $options[$number[0]];
    $class = get_class($wp_registered_widgets[$id]['callback'][0]);
    // maybe the widget is removed or deregistered
    if (!$instance || !$class) {
        return;
    }
    // set this title to something arbitrary so we can remove it later on
    if ($title == false) {
        $args['before_title'] = '<div class="wsh-title">';
        $args['after_title'] = '</div>';
    }
    ob_start();
    the_widget($class, $instance, $args);
    $content = ob_get_clean();
    if ($title == false) {
        $content = preg_replace('/<div class="wsh-title">(.*?)<\\/div>/', '', $content);
    }
    if ($echo !== true) {
        return $content;
    }
    echo $content;
}
Exemplo n.º 12
0
/** widget
  * Objective:
  *		1.Used to add widgets in content area.
**/
function my_shortcode_widget($attrs)
{
    global $wp_widget_factory;
    extract(shortcode_atts(array('widget_name' => FALSE, 'widget_class_name' => FALSE), $attrs));
    foreach ($attrs as $key => $value) {
        switch ($key) {
            case 'exclude_replies':
            case 'time':
            case 'display_avatar':
                $instance[$key] = $value == "yes" ? $value : NULL;
                break;
            default:
                $instance[$key] = $value;
                break;
        }
    }
    $instance = array_filter($instance);
    $widget_name = esc_html($widget_name);
    if (!is_a($wp_widget_factory->widgets[$widget_name], 'WP_Widget')) {
        $wp_class = 'WP_Widget_' . ucwords(strtolower($class));
        if (!is_a($wp_widget_factory->widgets[$wp_class], 'WP_Widget')) {
            return '<p>' . sprintf(__("%s: Widget class not found. Make sure this widget exists and the class name is correct", 'dt_delicate'), '<strong>' . $class . '</strong>') . '</p>';
        } else {
            $class = $wp_class;
        }
    }
    ob_start();
    the_widget($widget_name, $instance, array('before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => ''));
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Exemplo n.º 13
0
function most_shared_posts_shortcode_widget_placer($atts)
{
    extract(shortcode_atts(array('title' => 'Most Shared Posts', 'num_posts' => '5', 'max_month_age' => '24'), $atts));
    $widget_instance = array('title' => $title, 'recency_limit_unit' => 'months', 'recency_limit_number' => $max_month_age, 'number_of_posts_to_list' => $num_posts);
    $args = array();
    the_widget('Most_Shared_Posts', $widget_instance, $args);
}
function sandwich_tag_cloud_widget_shortcode($attr, $content)
{
    $default = '';
    foreach (get_taxonomies() as $taxonomy) {
        $tax = get_taxonomy($taxonomy);
        if (!$tax->show_tagcloud || empty($tax->labels->name)) {
            continue;
        }
        $default = esc_attr($taxonomy);
        break;
    }
    $attr = wp_parse_args($attr, array('title' => __('Tag Cloud', 'pbsandwich'), 'taxonomy' => $default, 'hide_title' => false));
    $hideTitleClass = '';
    if ($attr['hide_title']) {
        $hideTitleClass = 'hide_title';
    }
    ob_start();
    ?>
	<div class="sandwich <?php 
    echo $hideTitleClass;
    ?>
">
		<?php 
    the_widget('WP_Widget_Tag_Cloud', $attr);
    ?>
	</div>
	
	<?php 
    return ob_get_clean();
}
function sandwich_jetpack_gravatar_profile_widget_shortcode($attr, $content)
{
    if (!class_exists('Jetpack_Gravatar_Profile_Widget')) {
        return '';
    }
    $attr = wp_parse_args($attr, array('title' => __('Gravatar Profile', 'jetpack'), 'email_user' => '-1', 'email' => 5, 'show_personal_links' => false, 'show_account_links' => false, 'hide_title' => false));
    // In the Jetpack widget, if email_user is -1, the email inputted is used. If the email_user is a user_id, then the email of that user
    // is used. We do that directly from here
    if ($attr['email_user'] != -1) {
        $attr['email'] = $attr['email_user'];
    }
    $attr['show_personal_links'] = $attr['show_personal_links'] === 'true' || $attr['show_personal_links'] === true ? true : false;
    $attr['show_account_links'] = $attr['show_account_links'] === 'true' || $attr['show_account_links'] === true ? true : false;
    $hideTitleClass = '';
    if ($attr['hide_title']) {
        $hideTitleClass = 'hide_title';
    }
    ob_start();
    ?>
	<div class="sandwich <?php 
    echo $hideTitleClass;
    ?>
">
		<?php 
    the_widget('Jetpack_Gravatar_Profile_Widget', $attr);
    ?>
	</div>
	
	<?php 
    return ob_get_clean();
}
Exemplo n.º 16
0
 public function apanel_gateways_html($atts, $content)
 {
     //        global $wp_widget_factory;
     //
     //        extract(shortcode_atts(array(
     //            'widget_name' => FALSE
     //        ), $atts));
     //
     //        $widget_name = wp_specialchars($widget_name);
     //
     //        if (!is_a($wp_widget_factory->widgets[$widget_name], 'WP_Widget')):
     //            $wp_class = 'WP_Widget_'.ucwords(strtolower($class));
     //
     //            if (!is_a($wp_widget_factory->widgets[$wp_class], 'WP_Widget')):
     //                return '<p>'.sprintf(__("%s: Widget class not found. Make sure this widget exists and the class name is correct"),'<strong>'.$class.'</strong>').'</p>';
     //            else:
     //                $class = $wp_class;
     //            endif;
     //        endif;
     $widget_name = wp_specialchars('Skc_Apanel_Gateways_Widget');
     ob_start();
     the_widget($widget_name, $instance, array('widget_id' => 'arbitrary-instance-' . $id, 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => ''));
     $output = ob_get_contents();
     ob_end_clean();
     return $output;
 }
function sandwich_jetpack_display_wordpress_posts_widget_shortcode($attr, $content)
{
    if (!class_exists('Jetpack_Display_Posts_Widget')) {
        return '';
    }
    $attr = wp_parse_args($attr, array('title' => __('Display WordPress Posts', 'jetpack'), 'url' => '', 'number_of_posts' => 5, 'featured_image' => false, 'show_excerpts' => false, 'hide_title' => false));
    $attr['featured_image'] = $attr['featured_image'] === 'true' || $attr['featured_image'] === true ? true : false;
    $attr['show_excerpts'] = $attr['show_excerpts'] === 'true' || $attr['show_excerpts'] === true ? true : false;
    $hideTitleClass = '';
    if ($attr['hide_title']) {
        $hideTitleClass = 'hide_title';
    }
    ob_start();
    ?>
	<div class="sandwich <?php 
    echo $hideTitleClass;
    ?>
">
		<?php 
    the_widget('Jetpack_Display_Posts_Widget', $attr);
    ?>
	</div>
	
	<?php 
    return ob_get_clean();
}
Exemplo n.º 18
0
function mystique_widget($atts)
{
    global $wp_widget_factory;
    extract(shortcode_atts(array('class' => FALSE), $atts));
    ob_start();
    $class = wp_specialchars($class);
    if (!is_a($wp_widget_factory->widgets[$class], 'WP_Widget')) {
        $wp_class = 'WP_Widget_' . ucwords(strtolower($class));
        if (!is_a($wp_widget_factory->widgets[$wp_class], 'WP_Widget')) {
            return '<p class="error">' . sprintf(__("%s: Widget class not found. Make sure this widget exists and the class name is correct", "mystique"), '<strong>' . $class . '</strong>') . '</p>';
        } else {
            $class = $wp_class;
        }
    }
    $instance = array();
    // other attributes
    foreach ($atts as $att => $val) {
        if ($att != "class") {
            $instance[wp_specialchars($att)] = wp_specialchars($val);
        }
    }
    $id = $class;
    $classname = $wp_widget_factory->widgets[$class]->widget_options['classname'];
    if (!$classname) {
        $classname = $id;
    }
    if (isset($instance['widget_id'])) {
        $id = $instance['widget_id'];
    }
    the_widget($class, $instance, array('widget_id' => 'arbitrary-instance-' . $id, 'before_widget' => '<div class="arbitrary-block block-' . $classname . '">', 'after_widget' => '</div>', 'before_title' => '<h2 class="title">', 'after_title' => '</h2>'));
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Exemplo n.º 19
0
 public function shortcode($atts, $content = null)
 {
     extract(shortcode_atts(array('message_height' => '6', 'fields' => 'name,email,telephone,message', 'required' => 'name,email,message', 'button_size' => 'medium', 'button_title' => 'Send message'), $atts));
     if (!class_exists('Presscore_Inc_Widgets_ContactForm')) {
         return '';
     }
     $message_height = absint($message_height);
     $button_size = in_array($button_size, array('small', 'medium', 'big')) ? $button_size : 'medium';
     switch ($button_size) {
         case 'small':
             $clean_button_size = 's';
             break;
         case 'big':
             $clean_button_size = 'l';
             break;
         default:
             $clean_button_size = 'm';
     }
     $button_title = $button_title ? esc_html($button_title) : 'Send message';
     $required = array_map('trim', explode(',', $required));
     $fields = array_map('trim', explode(',', $fields));
     $clear_fields = array();
     foreach ($fields as $field) {
         if (!isset(Presscore_Inc_Widgets_ContactForm::$fields_list[$field])) {
             continue;
         }
         $clear_fields[$field] = array('on' => true, 'required' => in_array($field, $required));
     }
     $widget_args = array('before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '');
     $widget_params = array('title' => '', 'fields' => $clear_fields, 'text' => '', 'msg_height' => $message_height, 'button_size' => $clean_button_size, 'button_title' => $button_title);
     ob_start();
     the_widget('Presscore_Inc_Widgets_ContactForm', $widget_params, $widget_args);
     $output = ob_get_clean();
     return $output;
 }
Exemplo n.º 20
0
function jj_ngg_jquery_carousel_shortcode_handler($atts)
{
    $instance = array();
    foreach ($atts as $att => $val) {
        $instance[wp_specialchars($att)] = wp_specialchars($val);
    }
    // Set defaults
    if (WPJJNGGJ_CAROUSEL_use_default($instance, 'html_id')) {
        $instance['html_id'] = 'jcarousel';
    }
    if (WPJJNGGJ_CAROUSEL_use_default($instance, 'order')) {
        $instance['order'] = 'random';
    }
    if (WPJJNGGJ_CAROUSEL_use_default($instance, 'scroll')) {
        $instance['scroll'] = '1';
    }
    if (WPJJNGGJ_CAROUSEL_use_default($instance, 'visible')) {
        $instance['visible'] = '1';
    }
    if (WPJJNGGJ_CAROUSEL_use_default($instance, 'wrap')) {
        $instance['wrap'] = 'circular';
    }
    $instance['shortcode'] = '1';
    ob_start();
    the_widget("JJ_NGG_JQuery_Carousel", $instance, array());
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Exemplo n.º 21
0
 function do_widget_shortcode($atts)
 {
     $default_args = array('name' => '', 'class' => '', 'instance' => '', 'args' => '');
     extract(shortcode_atts($default_args, $atts));
     /*
             if ( is_array( $atts ) ) {
                 $atts = CCS_Content::get_all_atts( $atts );
             }
     */
     if (empty($instance)) {
         $widget_default_instance = array('title' => '', 'count' => '', 'dropdown' => '', 'hierarchical' => '', 'category' => '', 'description' => '', 'rating' => '', 'images' => '', 'name' => '', 'sortby' => '', 'exclude' => '', 'number' => '', 'url' => '', 'items' => '', 'show_summary' => '', 'show_author' => '', 'show_date' => '', 'taxonomy' => '', 'text' => '', 'filter' => '');
         // Extract instance parameters
         $instance = array();
         foreach ($widget_default_instance as $key => $value) {
             if (!empty($atts[$key])) {
                 switch ($key) {
                     case 'show_summary':
                     case 'show_author':
                     case 'show_date':
                         if ($atts[$key] == "true") {
                             $instance[$key] = "1";
                         }
                         break;
                     default:
                         $instance[$key] = $atts[$key];
                         break;
                 }
             } else {
                 // Default values necessary
                 if ($name == "rss") {
                     if (empty($instance['item'])) {
                         $instance['items'] = 5;
                     }
                 }
             }
         }
     }
     if (empty($args)) {
         $widget_default_args = array('before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '');
         $args = array();
         foreach ($widget_default_args as $key => $value) {
             if (!empty($atts[$key])) {
                 $args[$key] = $atts[$key];
             }
         }
     }
     if (!empty($name)) {
         // Get widget class name
         $widget = "WP_Widget_";
         if ($name == "rss") {
             $name = "RSS";
         }
         $widget .= str_replace(" ", "_", ucwords($name));
         // Uppercase each word, with underscore between
         ob_start();
         the_widget($widget, $instance, $args);
         return ob_get_clean();
     }
 }
Exemplo n.º 22
0
 /**
  * Displays the widget
  * @param  string $widget   The widget type
  * @param  array  $instance The widget instance
  * @return void
  */
 public static function displayWidget($widget, $instance = array())
 {
     if (array_key_exists($widget, self::$widgetIndexList) && class_exists($widget)) {
         the_widget($widget, $instance);
     } else {
         echo "Error: Widget prohibited or class not found.";
     }
 }
Exemplo n.º 23
0
/**
 * Add the search widget to the nav
 */
function korolyov_new_nav_menu_items($items, $args)
{
    if ($args->theme_location == 'primary') {
        $homelink = the_widget('WP_Widget_Search');
        $items = $items . $homelink;
    }
    return $items;
}
 public function shortcode_build($atts, $content = 'null')
 {
     $this->args = shortcode_atts($this->default_args, $atts, 'genesis_featured_post');
     ob_start();
     the_widget('Genesis_Featured_Post', $this->args, $this->args);
     $featured_post = ob_get_clean();
     return $featured_post;
 }
 public function register_shortcode($atts, $content = null)
 {
     $atts = shortcode_atts(array('page' => '', 'layout' => 'block', 'read_more_text' => __('Read more', 'vc-elements-pt'), 'tag' => ''), $atts);
     $instance = array('page_id' => absint($atts['page']), 'layout' => $atts['layout'], 'read_more_text' => $atts['read_more_text'], 'tag' => $atts['tag']);
     ob_start();
     the_widget('PW_Featured_Page', $instance);
     return ob_get_clean();
 }
 public function register_shortcode($atts, $content = null)
 {
     $atts = shortcode_atts(array('title' => 'Not sure which solution fits you business needs?'), $atts);
     $instance = array('text' => $atts['title'], 'button_text' => $content);
     ob_start();
     the_widget('PW_Call_To_Action', $instance);
     return ob_get_clean();
 }
Exemplo n.º 27
0
 function display_social_profiles()
 {
     $widget_name = 'ThematerSocialProfiles';
     $args = array('before_widget' => '', 'after_widget' => '');
     $get_instance = $this->theme->get_option('themater_social_profiles_networks');
     $instance = array('profiles' => $get_instance);
     the_widget($widget_name, $instance, $args);
 }
 public function shortcode_build($atts, $content = 'null')
 {
     $this->args = shortcode_atts($this->default_args, $atts, 'genesis_user_profile');
     ob_start();
     the_widget('Genesis_User_Profile_Widget', $this->args, $this->args);
     $user_profile = ob_get_clean();
     return $user_profile;
 }
 public function register_shortcode($atts, $content = null)
 {
     $atts = shortcode_atts(array('title' => '', 'url' => '', 'new_tab' => '', 'text' => '', 'icon' => 'fa-file-text-o'), $atts);
     $instance = array('title' => $atts['title'], 'brochure_url' => $atts['url'], 'brochure_icon' => $atts['icon'], 'brochure_text' => $atts['text'], 'new_tab' => $atts['new_tab']);
     ob_start();
     the_widget('PW_Brochure_Box', $instance);
     return ob_get_clean();
 }
Exemplo n.º 30
-1
    function wpex_cart_widget_dropdown()
    {
        // If disabled bail
        if (!get_theme_mod('woo_menu_icon', true)) {
            return;
        }
        // Do nothing if it isn't the corrent style
        if ('drop-down' != get_theme_mod('woo_menu_icon_style', 'drop-down')) {
            return;
        }
        // Globals & vars
        global $woocommerce;
        $shop_page_url = get_permalink(woocommerce_get_page_id('shop'));
        $cart_contents_count = $woocommerce->cart->cart_contents_count;
        // Not needed on checkout
        if (is_checkout()) {
            return false;
        }
        // Not needed on cart page when items exist
        if (is_cart() && sizeof($cart_contents_count) !== 0) {
            return false;
        }
        ?>
		
		<div id="current-shop-items-dropdown" class="clr">
			<div id="current-shop-items-inner" class="clr">
				<?php 
        // Display WooCommerce cart
        the_widget('WC_Widget_Cart', 'title= ');
        ?>
			</div><!-- #current-shop-items-inner -->
		</div><!-- #current-shop-items-dropdown -->
		
	<?php 
    }