Example #1
0
 /**
  * Renders the form for the widget
  *
  * @param array $data Database values
  */
 public function form($data)
 {
     $defaults = array('core_campus_id' => null, 'core_id' => null, 'core_involvement_id' => null, 'limit' => null, 'start_date' => null, 'end_date' => null);
     $data = array_merge($defaults, $data);
     parent::form($data);
 }
			<?php 
        }
    }
    $args = array('post_type' => 'any', 'post_status' => 'any', 'posts_per_page' => -1, 'update_post_term_cache' => false, 'meta_query' => array(array('key' => SHORTCODE_META, 'compare' => 'EXISTS')));
    $posts = get_posts($args);
    if (count($posts) > 0) {
        $wp_customize->add_section(__NAMESPACE__, array('title' => __('Category Posts Shortcode', TEXTDOMAIN), 'priority' => 200));
        foreach ($posts as $p) {
            $widget = new Widget();
            $widget->number = $p->ID;
            $meta = get_post_meta($p->ID, SHORTCODE_META, true);
            if (!is_array($meta)) {
                continue;
            }
            ob_start();
            $widget->form(array());
            $form = ob_get_clean();
            $form = preg_replace_callback('/<(input|select)\\s+.*name=("|\').*\\[\\d*\\]\\[([^\\]]*)\\][^>]*>/', function ($matches) use($p, $wp_customize, $meta) {
                $setting = '_virtual-' . WIDGET_BASE_ID . '[' . $p->ID . '][' . $matches[3] . ']';
                if (!isset($meta[$matches[3]])) {
                    $meta[$matches[3]] = null;
                }
                $wp_customize->add_setting($setting, array('default' => $meta[$matches[3]], 'type' => 'option'));
                return str_replace('<' . $matches[1], '<' . $matches[1] . ' data-customize-setting-link="' . $setting . '"', $matches[0]);
            }, $form);
            $wp_customize->add_control(new shortCodeControl($wp_customize, '_virtual-' . WIDGET_BASE_ID . '[' . $p->ID . '][title]', array('label' => __('Layout', 'twentyfourteen'), 'section' => __NAMESPACE__, 'form' => $form, 'settings' => '_virtual-' . WIDGET_BASE_ID . '[' . $p->ID . '][title]', 'active_callback' => function () use($p) {
                return is_singular() && get_the_ID() == $p->ID;
            })));
        }
    }
}
Example #3
0
 /**
  * Renders the form for the widget
  *
  * @param array $data Database values
  */
 public function form($data)
 {
     $defaults = array('title' => 'Instagram', 'columns' => 2, 'username' => null, 'limit' => 4, 'before_content' => '', 'after_content' => '');
     $data = array_merge($defaults, $data);
     parent::form($data);
 }
 /**
  * Renders the form for the widget
  * 
  * @param array $data Database values
  */
 public function form($data)
 {
     $defaults = array('columns' => 2, 'images' => array(), 'image_links' => array(), 'before_content' => '', 'after_content' => '');
     $data = array_merge($defaults, $data);
     parent::form($data);
 }
Example #5
0
 /**
  * Renders the form for the widget
  *
  * @param array $data Database values
  */
 public function form($data)
 {
     $defaults = array('title' => null, 'twitter_limit' => null);
     $data = array_merge($defaults, $data);
     parent::form($data);
 }