Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // set form variables
- $instance = wp_parse_args(
- (array) $instance,
- array(
- 'title' => 'Latest Updates',
- 'numberposts' => 5,
- 'post_type' => 'post',
- 'show_advanced' => 'no',
- 'taxonomies' => '--'
- )
- );
- $selected = 'selected="selected"';
- $checked = 'checked="checked"';
- ?>
- <p> <!-- TITLE FOR WIDGET -->
- <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label><br/>
- <input id="<?php echo $this->get_field_id('title'); ?>"
- name="<?php echo $this->get_field_name('title'); ?>"
- type="text"
- value="<?php echo $instance['title']; ?>" />
- </p>
- <p> <!-- NUMBER POSTS FOR WIDGET -->
- <label for="<?php echo $this->get_field_id('numberposts'); ?>"><?php _e('Number of posts to show:'); ?></label>
- <input id="<?php echo $this->get_field_id('numberposts'); ?>"
- name="<?php echo $this->get_field_name('numberposts'); ?>"
- type="text"
- value="<?php echo $instance['numberposts']; ?>"
- size="3"
- />
- </p>
- <p> <!-- ORDER POSTS -->
- <label for="<?php echo $this->get_field_id('orderby'); ?>"><?php _e('Order Posts By:'); ?></label>
- <select
- name="<?php echo $this->get_field_name('orderby'); ?>"
- id="<?php echo $this->get_field_id('orderby'); ?>"
- class="<?php echo $this->get_field_id('orderby'); ?> tm_lcptu_orderby">
- <option value="none" <?php if($instance['orderby'] == 'none') echo $selected; ?>>- None -</option>
- <option value="ID" <?php if($instance['orderby'] == 'ID') echo $selected; ?>>ID</option>
- <option value="author" <?php if($instance['orderby'] == 'author') echo $selected; ?>>Author</option>
- <option value="title" <?php if($instance['orderby'] == 'title') echo $selected; ?>>Title</option>
- <option value="date" <?php if($instance['orderby'] == 'date') echo $selected; ?>>Post Date</option>
- <option value="modified" <?php if($instance['orderby'] == 'modified') echo $selected; ?>>Last Modified</option>
- <option value="parent" <?php if($instance['orderby'] == 'parent') echo $selected; ?>>Parent</option>
- <option value="rand" <?php if($instance['orderby'] == 'rand') echo $selected; ?>>Random</option>
- <option value="comment_count" <?php if($instance['orderby'] == 'comment_count') echo $selected; ?>># Of Comments</option>
- <option value="menu_order" <?php if($instance['orderby'] == 'menu_order') echo $selected; ?>>Menu Order</option>
- </select>
- </p>
- <p> <!-- ORDER DIRECTION -->
- <label for="<?php echo $this->get_field_id('order'); ?>"><?php _e('Order Direction:'); ?></label>
- <select
- name="<?php echo $this->get_field_name('order'); ?>"
- id="<?php echo $this->get_field_id('order'); ?>"
- class="<?php echo $this->get_field_id('order'); ?> tm_lcptu_order">
- <option value="ASC" <?php if($instance['order'] == 'ASC') echo $selected; ?>>Ascending</option>
- <option value="DESC" <?php if($instance['order'] == 'DESC') echo $selected; ?>>Descending</option>
- </select>
- </p>
- <p> <!-- TEXT WHEN NO POSTS -->
- <label for="<?php echo $this->get_field_id('empty_display'); ?>"><?php _e('Text to display when there are no posts (defaults to empty):'); ?></label>
- <input id="<?php echo $this->get_field_id('empty_display'); ?>"
- name="<?php echo $this->get_field_name('empty_display'); ?>"
- type="text"
- value="<?php echo $instance['empty_display']; ?>"
- />
- </p>
- <p> <!-- CUSTOM CSS CLASS -->
- <label for="<?php echo $this->get_field_id('css_class'); ?>"><?php _e('Custom CSS Class:'); ?></label>
- <input id="<?php echo $this->get_field_id('css_class'); ?>"
- name="<?php echo $this->get_field_name('css_class'); ?>"
- type="text"
- value="<?php echo $instance['css_class']; ?>"
- size="20"
- />
- </p>
- <p> <!-- POST TYPE FOR WIDGET -->
- <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Types:'); ?></label>
- <?php
- // Filter out post types that are internal such as attachments or internal theme post types used for options.
- $args = array(
- 'show_ui' => true,
- );
- $post_types = get_post_types($args, 'objects');
- foreach($post_types as $post_type=>$vars) {
- echo '<br /><input type="checkbox"
- name="'.$this->get_field_name('post_type').'[]"
- value="'.$post_type.'"';
- if( in_array($post_type, $instance['post_type'] ) ) echo 'checked="checked"';
- echo ' /> '.$vars->labels->name.'';
- }
- ?>
- </select>
- </p>
- <p> <!-- RANDOMIZE POSTS? -->
- <label for="<?php echo $this->get_field_id('randomize'); ?>"><?php _e('Randomize Output:'); ?></label>
- <input id="<?php echo $this->get_field_id('randomize'); ?>"
- name="<?php echo $this->get_field_name('randomize'); ?>"
- class="tm_lcptu_randomize"
- type="checkbox"
- value="yes"
- <?php if($instance['randomize'] == 'yes') echo $checked; ?>
- />
- </p>
- <p> <!-- SHOW THUMBNAILS? -->
- <label for="<?php echo $this->get_field_id('show_thumbnails'); ?>"><?php _e('Show Post Thumbnails:'); ?></label>
- <input id="<?php echo $this->get_field_id('show_thumbnails'); ?>"
- name="<?php echo $this->get_field_name('show_thumbnails'); ?>"
- class="tm_lcptu_show-thumbnails"
- type="checkbox"
- value="yes"
- size="3"
- <?php if($instance['show_thumbnails'] == 'yes') echo $checked; ?>
- />
- </p>
- <div class="<?php echo $this->get_field_id('show_thumbnails'); ?>" style="display: <?php echo ($instance['show_thumbnails'] == 'yes')? 'block' : 'none'; ?>;">
- <p> <!-- THUMBNAIL IMAGE FORMAT -->
- <label for="<?php echo $this->get_field_id('thumbnail_format'); ?>"><?php _e('Thumbnail Format:'); ?></label>
- <select
- name="<?php echo $this->get_field_name('thumbnail_format'); ?>"
- id="<?php echo $this->get_field_id('thumbnail_format'); ?>"
- class="<?php echo $this->get_field_id('thumbnail_format'); ?> tm_lcptu_thformat">
- <option value="0" <?php if($instance['thumbnail_format'] == $size) echo $selected; ?>>- None -</option>
- <?php
- foreach( get_intermediate_image_sizes() as $size): ?>
- <option value="<?php echo $size; ?>" <?php if($instance['thumbnail_format'] == $size) echo $selected; ?>><?php echo $size; ?></option>
- <?php endforeach; ?>
- </select>
- </p>
- <p> <!-- THUMBNAIL WIDTH -->
- <label for="<?php echo $this->get_field_id('thumbnail_width'); ?>"><?php _e('Width:'); ?></label>
- <input id="<?php echo $this->get_field_id('thumbnail_width'); ?>"
- name="<?php echo $this->get_field_name('thumbnail_width'); ?>"
- type="text"
- value="<?php echo $instance['thumbnail_width'] ? $instance['thumbnail_width'] : 0; ?>"
- size="3"
- />
- </p>
- <p> <!-- THUMBNAIL HEIGHT -->
- <label for="<?php echo $this->get_field_id('thumbnail_height'); ?>"><?php _e('Height:'); ?></label>
- <input id="<?php echo $this->get_field_id('thumbnail_height'); ?>"
- name="<?php echo $this->get_field_name('thumbnail_height'); ?>"
- type="text"
- value="<?php echo $instance['thumbnail_height'] ? $instance['thumbnail_height'] : 0; ?>"
- size="3"
- />
- </p>
- <p> <!-- DEFAULT IMAGE -->
- <label for="<?php echo $this->get_field_id('default_image'); ?>"><?php _e('Default Image (URL):'); ?></label>
- <input id="<?php echo $this->get_field_id('default_image'); ?>"
- name="<?php echo $this->get_field_name('default_image'); ?>"
- type="text"
- value="<?php echo $instance['default_image'] ?>"
- size="35"
- />
- </p>
- </div>
- <p> <!-- SHOW ADVANCED FILTERING OPTIONS? -->
- <label for="<?php echo $this->get_field_id('show_advanced'); ?>"><?php _e('Show advanced options:'); ?></label>
- <input id="<?php echo $this->get_field_id('show_advanced'); ?>"
- name="<?php echo $this->get_field_name('show_advanced'); ?>"
- class="tm_lcptu_show-advanced"
- type="checkbox"
- value="yes"
- size="3"
- <?php if($instance['show_advanced'] == 'yes') echo $checked; ?>
- />
- </p>
- <div class="<?php echo $this->get_field_id('show_advanced'); ?>" style="display: <?php echo ($instance['show_advanced'] == 'yes')? 'block' : 'none'; ?>;">
- <p> <!-- TAXONOMIES FOR POST TYPE -->
- <label for="<?php echo $this->get_field_id('taxonomies'); ?>"><?php _e('Taxonomy to filter by:'); ?></label>
- <select
- name="<?php echo $this->get_field_name('taxonomies'); ?>"
- id="<?php echo $this->get_field_id('taxonomies'); ?>"
- class="<?php echo $this->get_field_id('post_type'); ?> tm_lcptu_tax">
- <?php
- echo tm_latest_cp_widget::get_post_taxonomies($instance['post_type'], $instance['taxonomies']);
- ?>
- </select>
- </p>
- <div class="<?php echo $this->get_field_id('taxonomies'); ?>-container" style="display: <?php echo ($instance['taxonomies'] != '--')? 'block' : 'none'; ?>;">
- <p>
- <label for="<?php echo $this->get_field_id('tax_in'); ?>"><?php _e('Only show posts that are '); ?></label><select
- name="<?php echo $this->get_field_name('tax_in'); ?>" id="<?php echo $this->get_field_id('tax_in'); ?>">
- <option value="in"<?php if($instance['tax_in'] == 'in') echo $selected; ?>>in</option>
- <option value="not_in"<?php if($instance['tax_in'] == 'not_in') echo $selected; ?>>not in</option>
- <option value="and"<?php if($instance['tax_in'] == 'and') echo $selected; ?>>in all</option>
- </select><label for="<?php echo $this->get_field_id('tag_list'); ?>"><?php _e(' the following tags/categories:'); ?></label>
- </p>
- <div class="<?php echo $this->get_field_id('taxonomies'); ?>" id="<?php echo $this->get_field_name('tag_list'); ?>">
- <?php if($instance['taxonomies'] != '--') echo tm_latest_cp_widget::get_taxonomy_list($instance['taxonomies'], $this->get_field_name('tag_list'), $instance['tag_list']); ?>
- </div>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement