Exemplo n.º 1
0
 /**
  * @param unknown_type $settings
  * @param unknown_type $value
  */
 function gazeta_vc_order_attr($settings, $value)
 {
     $html = null;
     $order_array = function_exists('gazeta_post_order') ? gazeta_post_order() : '';
     $dependency = function_exists('vc_generate_dependencies_attributes') ? vc_generate_dependencies_attributes($settings) : '';
     $html .= '<div class="order_attr">';
     $html .= '<select name="' . $settings['param_name'] . '" id="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-textinput ' . $settings['param_name'] . ' ' . $settings['type'] . '_field">';
     foreach ($order_array as $k => $v) {
         $html .= '<option ' . selected($value, $k, false) . ' value="' . $k . '">' . $v . '</option>';
     }
     $html .= '</select>';
     $html .= '</div>';
     return $html;
 }
Exemplo n.º 2
0
        function form($instance)
        {
            $defaults = array('title' => __('Recent Posts', 'gazeta'), 'expiration' => 300, 'thumbnail_size' => 'image-370-243', 'layout' => 'classic', 'post_format' => '', 'post_tags' => '', 'post_categories' => '', 'ignore_sticky_posts' => 'on', 'category' => '', 'orderby' => 'ID', 'order' => 'DESC', 'posts_per_page' => 5);
            $instance = wp_parse_args((array) $instance, $defaults);
            ?>
				<p>
					<label for="<?php 
            echo esc_attr($this->get_field_id('title'));
            ?>
"><?php 
            _e('Title:', 'gazeta');
            ?>
</label>
					<input id="<?php 
            echo esc_attr($this->get_field_id('title'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('title'));
            ?>
" value="<?php 
            echo esc_attr($instance['title']);
            ?>
" style="width:100%;" />
				</p>
				<p>
					<label for="<?php 
            echo $this->get_field_id("expiration");
            ?>
"><?php 
            _e('Caching Expiration', 'gazeta');
            ?>
</label>
					<input id="<?php 
            echo $this->get_field_id("expiration");
            ?>
" name="<?php 
            echo $this->get_field_name("expiration");
            ?>
" type="text" value="<?php 
            echo esc_attr($instance["expiration"]);
            ?>
" style="width:100%;"/>
					<small><?php 
            _e('Time until expiration in seconds from now, or 0 for never expires. Ex: For one day, the expiration value would be: (60 * 60 * 24).', 'gazeta');
            ?>
</small>
				</p>				
				<p>
					<label for="<?php 
            echo esc_attr($this->get_field_id('thumbnail_size'));
            ?>
"><?php 
            _e('Thumbnail Size:', 'gazeta');
            ?>
</label>
					<input id="<?php 
            echo esc_attr($this->get_field_id('thumbnail_size'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('thumbnail_size'));
            ?>
" value="<?php 
            echo esc_attr($instance['thumbnail_size']);
            ?>
" style="width:100%;" />
					<small><?php 
            printf(__('Enter image size. Example: "thumbnail", "medium", "large", "full" or other sizes defined by current theme size: <strong>%s</strong>".', 'gazeta'), implode(", ", gazeta_get_thumbnail_image_sizes()));
            ?>
</small>
				</p>
				<p>
					<label for="<?php 
            echo $this->get_field_id("post_format");
            ?>
"><?php 
            _e('Post Format', 'gazeta');
            ?>
</label>
					<input id="<?php 
            echo $this->get_field_id("post_format");
            ?>
" name="<?php 
            echo $this->get_field_name("post_format");
            ?>
" type="text" value="<?php 
            echo esc_attr($instance["post_format"]);
            ?>
" style="width:100%;"/>
					<small><?php 
            _e('Specify Post Format to retrieve (post-format-standard, post-format-audio, post-format-gallery,post-format-image,post-format-video), leave blank for all.', 'gazeta');
            ?>
</small>
				</p>
				<p>
					<label for="<?php 
            echo $this->get_field_id("post_tags");
            ?>
"><?php 
            _e('Post Tags', 'gazeta');
            ?>
</label>
					<input id="<?php 
            echo $this->get_field_id("post_tags");
            ?>
" name="<?php 
            echo $this->get_field_name("post_tags");
            ?>
" type="text" value="<?php 
            echo esc_attr($instance["post_tags"]);
            ?>
" style="width:100%;"/>
					<small><?php 
            printf(__('Specify Post Tags to retrieve, use %s, separated by comma(,).', 'gazeta'), '<a href="' . admin_url('edit-tags.php?taxonomy=post_tag') . '">' . __('Tag Slugs', 'gazeta') . '</a>');
            ?>
</small>
				</p>
				<p>
					<label for="<?php 
            echo $this->get_field_id("post_categories");
            ?>
"><?php 
            _e('Post Categories', 'gazeta');
            ?>
</label>
					<input id="<?php 
            echo $this->get_field_id("post_categories");
            ?>
" name="<?php 
            echo $this->get_field_name("post_categories");
            ?>
" type="text" value="<?php 
            echo esc_attr($instance["post_categories"]);
            ?>
" style="width:100%;"/>
					<small><?php 
            printf(__('Specify Post Categories to retrieve, use %s, separated by comma(,).', 'gazeta'), '<a href="' . admin_url('edit-tags.php?taxonomy=category') . '">' . __('Category IDs', 'gazeta') . '</a>');
            ?>
</small>
				</p>				
				<p>
					<label for="<?php 
            echo esc_attr($this->get_field_id('ignore_sticky_posts'));
            ?>
"><?php 
            _e('Ignore Sticky Posts:', 'gazeta');
            ?>
</label>
					<input <?php 
            checked('on', esc_attr($instance['ignore_sticky_posts']), true);
            ?>
 type="checkbox" id="<?php 
            echo esc_attr($this->get_field_id('ignore_sticky_posts'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('ignore_sticky_posts'));
            ?>
"/>
				</p>
				<?php 
            if (function_exists('gazeta_post_orderby')) {
                ?>
					<p>  
					    <label for="<?php 
                echo esc_attr($this->get_field_id('orderby'));
                ?>
"><?php 
                _e('Order by:', 'gazeta');
                ?>
</label>
					    <select style="width:100%;" id="<?php 
                echo esc_attr($this->get_field_id('orderby'));
                ?>
" name="<?php 
                echo esc_attr($this->get_field_name('orderby'));
                ?>
">
					    	<?php 
                foreach (gazeta_post_orderby() as $key => $value) {
                    ?>
					    				<option <?php 
                    selected(esc_attr($instance['orderby']), esc_attr($key), true);
                    ?>
 value="<?php 
                    print esc_attr($key);
                    ?>
"><?php 
                    print esc_attr($value);
                    ?>
</option>
					    			<?php 
                }
                ?>
					    </select>  
					</p>
				<?php 
            }
            ?>
				<?php 
            if (function_exists('gazeta_post_order')) {
                ?>
					<p>  
					    <label for="<?php 
                echo esc_attr($this->get_field_id('order'));
                ?>
"><?php 
                _e('Order:', 'gazeta');
                ?>
</label>
					    <select style="width:100%;" id="<?php 
                echo esc_attr($this->get_field_id('order'));
                ?>
" name="<?php 
                echo esc_attr($this->get_field_name('order'));
                ?>
">
					    	<?php 
                foreach (gazeta_post_order() as $key => $value) {
                    ?>
					    				<option <?php 
                    selected(esc_attr($instance['order']), esc_attr($key), true);
                    ?>
 value="<?php 
                    print esc_attr($key);
                    ?>
"><?php 
                    print esc_attr($value);
                    ?>
</option>
					    			<?php 
                }
                ?>
					    </select>  
					</p>
				<?php 
            }
            ?>
				
				<p>  
				    <label for="<?php 
            echo esc_attr($this->get_field_id('posts_per_page'));
            ?>
"><?php 
            _e('Show Posts:', 'gazeta');
            ?>
</label>
				    <input id="<?php 
            echo esc_attr($this->get_field_id('posts_per_page'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('posts_per_page'));
            ?>
" value="<?php 
            echo esc_attr($instance['posts_per_page']);
            ?>
" style="width:100%;" />
				</p>
				<p>
					<?php 
            printf(__('Need more filters? check out %s filter hook.', 'gazeta'), '<code>gazeta_mega_posts/args</code>');
            ?>
				</p>
			<?php 
        }