first commit
This commit is contained in:
126
wp-content/themes/nuzi/framework/widget/contact_widget.php
Normal file
126
wp-content/themes/nuzi/framework/widget/contact_widget.php
Normal file
@ -0,0 +1,126 @@
|
||||
<?php
|
||||
class contactinfo extends WP_Widget {
|
||||
|
||||
function contactinfo() {
|
||||
$widget_ops = array(
|
||||
'classname' => 'flickr_widget',
|
||||
'description' => 'Contact info.'
|
||||
);
|
||||
$control_ops = array('width' => 80, 'height' => 80);
|
||||
parent::WP_Widget(false, 'Themewaves contact info', $widget_ops, $control_ops);
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
$instance = wp_parse_args((array) $instance, array('contact_title' => ''));
|
||||
$contact_title = isset($instance['contact_title']) ? strip_tags($instance['contact_title']) : '';
|
||||
$contact_address = isset($instance['contact_address']) ? strip_tags($instance['contact_address']) : '';
|
||||
$contact_phone = isset($instance['contact_phone']) ? strip_tags($instance['contact_phone']) : '';
|
||||
$contact_email_url = isset($instance['contact_email_url']) ? strip_tags($instance['contact_email_url']) : '';
|
||||
$contact_email = isset($instance['contact_email']) ? strip_tags($instance['contact_email']) : '';
|
||||
$contact_web_url = isset($instance['contact_web_url']) ? strip_tags($instance['contact_web_url']) : '';
|
||||
$contact_web = isset($instance['contact_web']) ? strip_tags($instance['contact_web']) : '';
|
||||
$contact_facebook_url = isset($instance['contact_facebook_url']) ? strip_tags($instance['contact_facebook_url']) : '';
|
||||
$contact_facebook = isset($instance['contact_facebook']) ? strip_tags($instance['contact_facebook']) : '';
|
||||
?>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('contact_title'); ?>"><?php _e('Title:', 'themewaves'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('contact_title'); ?>" name="<?php echo $this->get_field_name('contact_title'); ?>" type="text" value="<?php echo esc_attr($contact_title); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('contact_address'); ?>"><?php _e('Content address:', 'themewaves'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('contact_address'); ?>" name="<?php echo $this->get_field_name('contact_address'); ?>" type="text" value="<?php echo esc_attr($contact_address); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('contact_phone'); ?>"><?php _e('Contact phone number:', 'themewaves'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('contact_phone'); ?>" name="<?php echo $this->get_field_name('contact_phone'); ?>" type="text" value="<?php echo esc_attr($contact_phone); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('contact_email_url'); ?>"><?php _e('Contact email link url:', 'themewaves'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('contact_email_url'); ?>" name="<?php echo $this->get_field_name('contact_email_url'); ?>" type="text" value="<?php echo esc_attr($contact_email_url); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('contact_email'); ?>"><?php _e('Contact email:', 'themewaves'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('contact_email'); ?>" name="<?php echo $this->get_field_name('contact_email'); ?>" type="text" value="<?php echo esc_attr($contact_email); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('contact_web_url'); ?>"><?php _e('Contact web link url:', 'themewaves'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('contact_web_url'); ?>" name="<?php echo $this->get_field_name('contact_web_url'); ?>" type="text" value="<?php echo esc_attr($contact_web_url); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('contact_web'); ?>"><?php _e('Contact web:', 'themewaves'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('contact_web'); ?>" name="<?php echo $this->get_field_name('contact_web'); ?>" type="text" value="<?php echo esc_attr($contact_web); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('contact_facebook_url'); ?>"><?php _e('Contact facebook link url:', 'themewaves'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('contact_facebook_url'); ?>" name="<?php echo $this->get_field_name('contact_facebook_url'); ?>" type="text" value="<?php echo esc_attr($contact_facebook_url); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('contact_facebook'); ?>"><?php _e('Contact facebook:', 'themewaves'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('contact_facebook'); ?>" name="<?php echo $this->get_field_name('contact_facebook'); ?>" type="text" value="<?php echo esc_attr($contact_facebook); ?>" />
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
$instance = $old_instance;
|
||||
$instance['contact_title'] = strip_tags($new_instance['contact_title']);
|
||||
$instance['contact_address'] = strip_tags($new_instance['contact_address']);
|
||||
$instance['contact_phone'] = strip_tags($new_instance['contact_phone']);
|
||||
$instance['contact_email'] = strip_tags($new_instance['contact_email']);
|
||||
$instance['contact_email_url'] = strip_tags($new_instance['contact_email_url']);
|
||||
$instance['contact_web'] = strip_tags($new_instance['contact_web']);
|
||||
$instance['contact_web_url'] = strip_tags($new_instance['contact_web_url']);
|
||||
$instance['contact_facebook'] = strip_tags($new_instance['contact_facebook']);
|
||||
$instance['contact_facebook_url'] = strip_tags($new_instance['contact_facebook_url']);
|
||||
return $instance;
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
extract($args);
|
||||
$contact_title = apply_filters('widget_contact_title', empty($instance['contact_title']) ? '' : $instance['contact_title'], $instance);
|
||||
$contact_address = apply_filters('widget_contact_address', empty($instance['contact_address']) ? '' : $instance['contact_address'], $instance);
|
||||
$contact_phone = apply_filters('widget_contact_phone', empty($instance['contact_phone']) ? '' : $instance['contact_phone'], $instance);
|
||||
$contact_email = apply_filters('widget_contact_email', empty($instance['contact_email']) ? '' : $instance['contact_email'], $instance);
|
||||
$contact_email_url = apply_filters('widget_contact_email_url', empty($instance['contact_email_url']) ? '' : $instance['contact_email_url'], $instance);
|
||||
$contact_web = apply_filters('widget_contact_web', empty($instance['contact_web']) ? '' : $instance['contact_web'], $instance);
|
||||
$contact_web_url = apply_filters('widget_contact_web_url', empty($instance['contact_web_url']) ? '' : $instance['contact_web_url'], $instance);
|
||||
$contact_facebook = apply_filters('widget_contact_facebook', empty($instance['contact_facebook']) ? '' : $instance['contact_facebook'], $instance);
|
||||
$contact_facebook_url = apply_filters('widget_contact_facebook_url', empty($instance['contact_facebook_url']) ? '' : $instance['contact_facebook_url'], $instance);
|
||||
$class = apply_filters('widget_class', empty($instance['class']) ? '' : $instance['class'], $instance);
|
||||
|
||||
echo $before_widget;
|
||||
|
||||
$contact_title = $contact_title;
|
||||
|
||||
if (!empty($contact_title)) {
|
||||
echo $before_title . $contact_title . $after_title;
|
||||
}
|
||||
echo '<div class="contact-info-widget">';
|
||||
echo '<ul>';
|
||||
if(!empty($contact_address)){
|
||||
echo '<li><i class="icon-map-marker"></i><div>'.$contact_address.'</div></li>';
|
||||
}
|
||||
if(!empty($contact_phone)){
|
||||
echo '<li><i class="icon-phone"></i><div>'.$contact_phone.'</div></li>';
|
||||
}
|
||||
if(!empty($contact_email)){
|
||||
echo '<li><i class="icon-envelope-alt"></i><div><a target="_blank" href="'. to_url($contact_email_url).'">'.$contact_email.'</a></div></li>';
|
||||
}
|
||||
if(!empty($contact_web)){
|
||||
echo '<li><i class="icon-globe"></i><div><a target="_blank" href="'. to_url($contact_web_url).'">'.$contact_web.'</a></div></li>';
|
||||
}
|
||||
if(!empty($contact_facebook)){
|
||||
echo '<li><i class="icon-facebook"></i><div><a target="_blank" href="'. to_url($contact_facebook_url).'">'.$contact_facebook.'</a></div></li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
echo '</div>';
|
||||
?>
|
||||
|
||||
<?php
|
||||
echo $after_widget;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', create_function('', 'return register_widget("contactinfo");'));
|
||||
?>
|
78
wp-content/themes/nuzi/framework/widget/dribbble_widget.php
Normal file
78
wp-content/themes/nuzi/framework/widget/dribbble_widget.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
class dribbblewidget extends WP_Widget {
|
||||
|
||||
function dribbblewidget() {
|
||||
$widget_ops = array(
|
||||
'classname' => 'dribbble_widget',
|
||||
'description' => 'Images from your dribbble account.'
|
||||
);
|
||||
$control_ops = array('width' => 80, 'height' => 80);
|
||||
parent::WP_Widget(false, 'Themewaves dribbble', $widget_ops, $control_ops);
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
$instance = wp_parse_args((array) $instance, array('dribbble_title' => ''));
|
||||
$dribbble_title = isset($instance['dribbble_title']) ? strip_tags($instance['dribbble_title']) : '';
|
||||
$dribbble_userid = isset($instance['dribbble_userid']) ? strip_tags($instance['dribbble_userid']) : '';
|
||||
$dribbble_num = isset($instance['dribbble_num']) ? strip_tags($instance['dribbble_num']) : '';
|
||||
?>
|
||||
<p><label for="<?php echo $this->get_field_id('dribbble_title'); ?>"><?php _e('Title:', 'themewaves'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('dribbble_title'); ?>" name="<?php echo $this->get_field_name('dribbble_title'); ?>" type="text" value="<?php echo esc_attr($dribbble_title); ?>" /></p>
|
||||
<p><label for="<?php echo $this->get_field_id('dribbble_userid'); ?>"><?php _e('dribbble user ID:', 'themewaves'); ?></label>
|
||||
<br>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('dribbble_userid'); ?>" name="<?php echo $this->get_field_name('dribbble_userid'); ?>" type="text" value="<?php echo esc_attr($dribbble_userid); ?>" />
|
||||
<br>
|
||||
<small><em>Find ID <a href="http://dribbble.com/" target="_blank">http://dribbble.com/</a></em></small>
|
||||
</p>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id('dribbble_num'); ?>"><?php _e('How many dribbble display:', 'themewaves'); ?></label>
|
||||
<input maxlength="3" class="widefat" id="<?php echo $this->get_field_id('dribbble_num'); ?>" name="<?php echo $this->get_field_name('dribbble_num'); ?>" type="text" value="<?php echo esc_attr($dribbble_num); ?>" />
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
$instance = $old_instance;
|
||||
$instance['dribbble_title'] = strip_tags($new_instance['dribbble_title']);
|
||||
$instance['dribbble_userid'] = strip_tags($new_instance['dribbble_userid']);
|
||||
$instance['dribbble_num'] = strip_tags($new_instance['dribbble_num']);
|
||||
return $instance;
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
extract($args);
|
||||
$dribbble_title = apply_filters('widget_dribbble_title', empty($instance['dribbble_title']) ? '' : $instance['dribbble_title'], $instance);
|
||||
$dribbble_userid = apply_filters('widget_dribbble_userid', empty($instance['dribbble_userid']) ? '' : $instance['dribbble_userid'], $instance);
|
||||
$dribbble_num = apply_filters('widget_dribbble_num', empty($instance['dribbble_num']) ? '' : $instance['dribbble_num'], $instance);
|
||||
$class = apply_filters('widget_class', empty($instance['class']) ? '' : $instance['class'], $instance);
|
||||
echo $before_widget;
|
||||
if (!empty($dribbble_title)) {echo $before_title . $dribbble_title . $after_title;}
|
||||
echo '<div class="dribbble-widget">';
|
||||
$shots=false;
|
||||
$response = wp_remote_get( 'http://api.dribbble.com/players/' . $dribbble_userid . '/shots/?per_page='.$dribbble_num );
|
||||
if( !is_wp_error( $response ) ){
|
||||
$xml = wp_remote_retrieve_body( $response );
|
||||
if( !is_wp_error( $xml ) ){
|
||||
if( $response['headers']['status'] == 200 ) {
|
||||
$json = json_decode( $xml );
|
||||
$shots = $json->shots;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( $shots ) {
|
||||
foreach( $shots as $shot ){
|
||||
echo '<a href="' . $shot->url . '" target="_blank">';
|
||||
echo '<img src="' . $shot->image_teaser_url . '" alt="' . $shot->title . '" />';
|
||||
echo '</a>';
|
||||
}
|
||||
} else {
|
||||
echo __('Error', 'themewaves');
|
||||
}
|
||||
echo '</div>';
|
||||
echo $after_widget;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', create_function('', 'return register_widget("dribbblewidget");'));
|
||||
?>
|
77
wp-content/themes/nuzi/framework/widget/flickr_widget.php
Normal file
77
wp-content/themes/nuzi/framework/widget/flickr_widget.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
class flickrwidget extends WP_Widget {
|
||||
|
||||
function flickrwidget() {
|
||||
$widget_ops = array(
|
||||
'classname' => 'flickr_widget',
|
||||
'description' => 'Images from your Flickr account.'
|
||||
);
|
||||
$control_ops = array('width' => 80, 'height' => 80);
|
||||
parent::WP_Widget(false, 'Themewaves flickr', $widget_ops, $control_ops);
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
$instance = wp_parse_args((array) $instance, array('flickr_title' => ''));
|
||||
$flickr_title = isset($instance['flickr_title']) ? strip_tags($instance['flickr_title']) : '';
|
||||
$flickr_type = isset($instance['flickr_type']) ? strip_tags($instance['flickr_type']) : '';
|
||||
$flickr_userid = isset($instance['flickr_userid']) ? strip_tags($instance['flickr_userid']) : '';
|
||||
$flickr_num = isset($instance['flickr_num']) ? strip_tags($instance['flickr_num']) : '';
|
||||
?>
|
||||
<p><label for="<?php echo $this->get_field_id('flickr_title'); ?>"><?php _e('Title:', 'themewaves'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('flickr_title'); ?>" name="<?php echo $this->get_field_name('flickr_title'); ?>" type="text" value="<?php echo esc_attr($flickr_title); ?>" /></p>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('flickr_type'); ?>">Type (user or group):</label>
|
||||
<select id="<?php echo $this->get_field_id('flickr_type'); ?>" name="<?php echo $this->get_field_name('flickr_type'); ?>" class="widefat">
|
||||
<option <?php if ('user' == $flickr_type) echo 'selected="selected"'; ?>>user</option>
|
||||
<option <?php if ('group' == $flickr_type) echo 'selected="selected"'; ?>>group</option>
|
||||
</select>
|
||||
</p>
|
||||
<p><label for="<?php echo $this->get_field_id('flickr_userid'); ?>"><?php _e('Flickr user ID:', 'themewaves'); ?></label>
|
||||
<br>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('flickr_userid'); ?>" name="<?php echo $this->get_field_name('flickr_userid'); ?>" type="text" value="<?php echo esc_attr($flickr_userid); ?>" />
|
||||
<br>
|
||||
<small><em>Find ID <a href="http://idgettr.com/" target="_blank">http://idgettr.com/</a></em></small>
|
||||
</p>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id('flickr_num'); ?>"><?php _e('How many pictures display:', 'themewaves'); ?></label>
|
||||
<input maxlength="3" class="widefat" id="<?php echo $this->get_field_id('flickr_num'); ?>" name="<?php echo $this->get_field_name('flickr_num'); ?>" type="text" value="<?php echo esc_attr($flickr_num); ?>" />
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
$instance = $old_instance;
|
||||
$instance['flickr_title'] = strip_tags($new_instance['flickr_title']);
|
||||
$instance['flickr_type'] = strip_tags($new_instance['flickr_type']);
|
||||
$instance['flickr_userid'] = strip_tags($new_instance['flickr_userid']);
|
||||
$instance['flickr_num'] = strip_tags($new_instance['flickr_num']);
|
||||
return $instance;
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
extract($args);
|
||||
$flickr_title = apply_filters('widget_flickr_title', empty($instance['flickr_title']) ? '' : $instance['flickr_title'], $instance);
|
||||
$flickr_type = apply_filters('widget_flickr_type', empty($instance['flickr_type']) ? '' : $instance['flickr_type'], $instance);
|
||||
$flickr_userid = apply_filters('widget_flickr_userid', empty($instance['flickr_userid']) ? '' : $instance['flickr_userid'], $instance);
|
||||
$flickr_num = apply_filters('widget_flickr_num', empty($instance['flickr_num']) ? '' : $instance['flickr_num'], $instance);
|
||||
$class = apply_filters('widget_class', empty($instance['class']) ? '' : $instance['class'], $instance);
|
||||
|
||||
echo $before_widget;
|
||||
|
||||
$flickr_title = $flickr_title;
|
||||
|
||||
if (!empty($flickr_title)) {
|
||||
echo $before_title . $flickr_title . $after_title;
|
||||
}
|
||||
echo '<div class="flickr-widget">';
|
||||
echo '<div class="flickr-channel">'; ?>
|
||||
<script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?count=<?php echo $flickr_num ?>&size=s&layout=v&source=<?php echo $flickr_type ?>&<?php echo $flickr_type ?>=<?php echo $flickr_userid ?>"></script><?php
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo $after_widget;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', create_function('', 'return register_widget("flickrwidget");'));
|
||||
?>
|
174
wp-content/themes/nuzi/framework/widget/recent_posts_widget.php
Normal file
174
wp-content/themes/nuzi/framework/widget/recent_posts_widget.php
Normal file
@ -0,0 +1,174 @@
|
||||
<?php
|
||||
class TWRecentPostWidget extends WP_Widget {
|
||||
function TWRecentPostWidget() {
|
||||
$widget_ops = array('classname' => 'TWRecentPostWidget', 'description' => 'Themewaves recent posts.');
|
||||
parent::WP_Widget(false, 'Themewaves recent posts', $widget_ops);
|
||||
}
|
||||
function widget($args, $instance) {
|
||||
global $post;
|
||||
extract(array(
|
||||
'title' => '',
|
||||
'number_posts' => 5,
|
||||
'theme' => 'post_nothumbnailed',
|
||||
'post_order' => 'latest',
|
||||
'post_type' => 'post'
|
||||
));
|
||||
extract($args);
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
$post_count = 5;
|
||||
if (isset($instance['number_posts']))
|
||||
$post_count = $instance['number_posts'];
|
||||
$q['posts_per_page'] = $post_count;
|
||||
$cats = (array) $instance['post_category'];
|
||||
$q['paged'] = 1;
|
||||
$q['post_type'] = $instance['post_type'];
|
||||
if (count($cats) > 0) {
|
||||
$typ = 'category';
|
||||
if ($instance['post_type'] != 'post')
|
||||
$typ = 'catalog';
|
||||
$catq = '';
|
||||
$sp = '';
|
||||
foreach ($cats as $mycat) {
|
||||
$catq = $catq . $sp . $mycat;
|
||||
$sp = ',';
|
||||
}
|
||||
$catq = split(',', $catq);
|
||||
$q['tax_query'] = Array(Array(
|
||||
'taxonomy' => $typ,
|
||||
'terms' => $catq,
|
||||
'field' => 'id'
|
||||
)
|
||||
);
|
||||
}
|
||||
if ($instance['post_order'] == 'commented')
|
||||
$q['orderby'] = 'comment_count';
|
||||
query_posts($q);
|
||||
if (isset($before_widget))
|
||||
echo $before_widget;
|
||||
if ($title != '')
|
||||
echo $args['before_title'] . $title . $args['after_title'];
|
||||
echo '<div class="tw-recent-posts-widget">';
|
||||
echo '<ul>';
|
||||
while (have_posts ()) : the_post();
|
||||
echo '<li>';
|
||||
$class = "with-thumb";
|
||||
if (isset($instance['theme']) && $instance['theme'] == 'post_thumbnailed') {
|
||||
if (has_post_thumbnail($post->ID)) {
|
||||
$lrg_img = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail');
|
||||
$feat_img = $lrg_img[0];
|
||||
$thumb_width = 48;
|
||||
$thumb_height = 48;
|
||||
echo '<div class="recent-thumb image"><img style="width:' . $thumb_width . 'px; height:' . $thumb_height . 'px" src="' . $feat_img . '" alt="' . get_the_title() . '"/></div>';
|
||||
} else {
|
||||
$class = "no-thumb";
|
||||
}
|
||||
} else {
|
||||
$format = get_post_format() == "" ? "standard" : get_post_format();
|
||||
echo '<div class="recent-thumb"><span class="post-format '.$format.'"></span></div>';
|
||||
}
|
||||
echo '<div class="tw-recent-content '.$class.'">';
|
||||
echo '<h4><a href="'.get_permalink().'">'.get_the_title().'</a></h4>';
|
||||
echo '<div class="meta">';
|
||||
_e("On ", "themewaves");
|
||||
echo '<span class="date"><span class="day">'.get_the_date('j').'</span> <span class="month">'.get_the_date('M').'</span></span>';
|
||||
// _e(", In ", "themewaves");
|
||||
// echo get_the_category_list(', ');
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</li>';
|
||||
endwhile;
|
||||
echo '</ul>';
|
||||
echo '</div>';
|
||||
if (isset($after_widget))
|
||||
echo $after_widget;
|
||||
wp_reset_query();
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
$instance = $old_instance;
|
||||
/* Strip tags (if needed) and update the widget settings. */
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
if ($new_instance['post_type'] == 'post') {
|
||||
$instance['post_category'] = $_REQUEST['post_category'];
|
||||
} else {
|
||||
$tax = get_object_taxonomies($new_instance['post_type']);
|
||||
$instance['post_category'] = $_REQUEST['tax_input'][$tax[0]];
|
||||
}
|
||||
$instance['number_posts'] = strip_tags($new_instance['number_posts']);
|
||||
$instance['post_type'] = strip_tags($new_instance['post_type']);
|
||||
$instance['post_order'] = strip_tags($new_instance['post_order']);
|
||||
$instance['theme'] = strip_tags($new_instance['theme']);
|
||||
return $instance;
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
//Output admin widget options form
|
||||
extract(shortcode_atts(array(
|
||||
'title' => '',
|
||||
'theme' => 'post_nothumbnailed',
|
||||
'number_posts' => 5,
|
||||
'post_order' => 'latest',
|
||||
'post_type' => 'post'
|
||||
), $instance));
|
||||
$defaultThemes = Array(
|
||||
Array("name" => 'Thumbnailed posts', 'user_func' => 'post_thumbnailed'),
|
||||
Array("name" => 'Default posts', 'user_func' => 'post_nonthumbnailed')
|
||||
);
|
||||
$themes = apply_filters('tw_recent_posts_widget_theme_list', $defaultThemes);
|
||||
$defaultPostTypes = Array(Array("name" => 'Post', 'post_type' => 'post')); ?>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e("Title:", "themewaves");?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('post_order'); ?>">Post order:</label>
|
||||
<select class="widefat" id="<?php echo $this->get_field_id('post_order'); ?>" name="<?php echo $this->get_field_name('post_order'); ?>">
|
||||
<option value="latest" <?php if ($post_order == 'latest') print 'selected="selected"'; ?>>Latest posts</option>
|
||||
<option value="commented" <?php if ($post_order == 'commented') print 'selected="selected"'; ?>>Most commented posts</option>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('theme'); ?>">Post theme:</label>
|
||||
<select class="widefat" id="<?php echo $this->get_field_id('theme'); ?>" name="<?php echo $this->get_field_name('theme'); ?>">
|
||||
<option value="post_thumbnailed" <?php if ($theme == 'post_thumbnailed') print 'selected="selected"'; ?>>Thumbnail</option>
|
||||
<option value="post_nothumbnailed" <?php if ($theme == 'post_nothumbnailed') print 'selected="selected"'; ?>>No Thumbnail</option>
|
||||
</select>
|
||||
</p><?php
|
||||
$customTypes = apply_filters('tw_recent_posts_widget_type_list', $defaultPostTypes);
|
||||
if (count($customTypes) > 0) { ?>
|
||||
<p style="display: none;">
|
||||
<label for="<?php echo $this->get_field_id('post_type'); ?>">Post from:</label>
|
||||
<select rel="<?php echo $this->get_field_id('post_cats'); ?>" onChange="tw_get_post_terms(this);" class="widefat" id="<?php echo $this->get_field_id('post_type'); ?>" name="<?php echo $this->get_field_name('post_type'); ?>"><?php
|
||||
foreach ($customTypes as $postType) { ?>
|
||||
<option value="<?php print $postType['post_type'] ?>" <?php echo selected($post_type, $postType['post_type']); ?>><?php print $postType['name'] ?></option><?php
|
||||
} ?>
|
||||
</select>
|
||||
</p><?php
|
||||
} ?>
|
||||
<p>If you were not selected for cats, it will show all categories.</p>
|
||||
<div id="<?php echo $this->get_field_id('post_cats'); ?>" style="height:150px; overflow:auto; border:1px solid #dfdfdf;"><?php
|
||||
$post_type='post';
|
||||
$tax = get_object_taxonomies($post_type);
|
||||
|
||||
$selctedcat = false;
|
||||
if (isset($instance['post_category']) && $instance['post_category'] != ''){
|
||||
$selctedcat = $instance['post_category'];
|
||||
}
|
||||
wp_terms_checklist(0, array('taxonomy' => $tax[0], 'checked_ontop' => false, 'selected_cats' => $selctedcat)); ?>
|
||||
</div>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('number_posts'); ?>">Number of posts to show:</label>
|
||||
<input id="<?php echo $this->get_field_id('number_posts'); ?>" name="<?php echo $this->get_field_name('number_posts'); ?>" value="<?php echo $number_posts; ?>" size="3" />
|
||||
</p><?php
|
||||
}
|
||||
}
|
||||
add_action('widgets_init', create_function('', 'return register_widget("TWRecentPostWidget");'));
|
||||
add_action('wp_ajax_themewave_recent_post_terms', 'get_post_type_terms');
|
||||
function get_post_type_terms() {
|
||||
$cat = 'post';
|
||||
if (isset($_REQUEST['post_format']) && $_REQUEST['post_format'] != '')
|
||||
$cat = $_REQUEST['post_format'];
|
||||
$tax = get_object_taxonomies($cat);
|
||||
wp_terms_checklist(0, array('taxonomy' => $tax[0], 'checked_ontop' => false, 'selected_cats' => false));
|
||||
die;
|
||||
} ?>
|
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
class sociallinkswidget extends WP_Widget {
|
||||
|
||||
function sociallinkswidget() {
|
||||
$widget_ops = array('classname' => 'sociallinkswidget', 'description' => 'Displays your social profile.');
|
||||
|
||||
parent::WP_Widget(false, 'Themewaves Social', $widget_ops);
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
extract($args);
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
echo $before_widget;
|
||||
if ($title){echo $before_title . $title . $after_title;}
|
||||
global $tw_socials;
|
||||
echo '<div class="tw-social-icon clearfix">';
|
||||
foreach ($tw_socials as $key => $social) {
|
||||
if(!empty($instance[$social['name']])){
|
||||
echo '<a href="'.str_replace('*',$instance[$social['name']],$social['link']).'" target="_blank" title="'.$key.'" class="'.$key.'"><span class="tw-icon-'.$key.'"></span></a>';
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
echo $after_widget;
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
$instance = $old_instance;
|
||||
$instance = $new_instance;
|
||||
/* Strip tags (if needed) and update the widget settings. */
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
return $instance;
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
global $tw_socials; ?>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('title'); ?>">Title:</label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo isset($instance['title']) ? $instance['title'] : ''; ?>" />
|
||||
</p> <?php
|
||||
foreach ($tw_socials as $key => $social) { ?>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id($social['name']); ?>"><?php echo $key; ?>:</label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id($social['name']); ?>" name="<?php echo $this->get_field_name($social['name']); ?>" value="<?php echo isset($instance[$social['name']]) ? $instance[$social['name']] : ''; ?>" />
|
||||
</p><?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_action('widgets_init', create_function('', 'return register_widget("sociallinkswidget");'));
|
||||
?>
|
46
wp-content/themes/nuzi/framework/widget/twitter_widget.php
Normal file
46
wp-content/themes/nuzi/framework/widget/twitter_widget.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
class twitterwidget extends WP_Widget {
|
||||
function twitterwidget() {
|
||||
$widget_ops = array('classname' => 'twitterwidget', 'description' => 'Displays your Tweets.');
|
||||
parent::WP_Widget(false, 'Themewaves Twitter', $widget_ops);
|
||||
}
|
||||
function form($instance){ ?>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('title'); ?>">Title:</label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo isset($instance['title']) ? $instance['title'] : ''; ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('username'); ?>">User Name:</label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('username'); ?>" name="<?php echo $this->get_field_name('username'); ?>" value="<?php echo isset($instance['username']) ? $instance['username'] : ''; ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('tweetstoshow'); ?>">Tweets to display:</label>
|
||||
<select class="widefat" id="<?php echo $this->get_field_id('tweetstoshow'); ?>" name="<?php echo $this->get_field_name('tweetstoshow'); ?>"><?php
|
||||
for($i=1;$i<=10;$i++){
|
||||
echo '<option value="'.$i.'"'.(isset($instance['tweetstoshow'])&&$instance['tweetstoshow'] == $i?' selected="selected"':'').'>'.$i.'</option>';
|
||||
} ?>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('cachetime'); ?>">cachetime:</label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('cachetime'); ?>" name="<?php echo $this->get_field_name('cachetime'); ?>" value="<?php echo isset($instance['cachetime']) ? $instance['cachetime'] : ''; ?>" />
|
||||
</p><?php
|
||||
}
|
||||
function update($new_instance, $old_instance) {
|
||||
$instance = $old_instance;
|
||||
$instance = $new_instance;
|
||||
/* Strip tags (if needed) and update the widget settings. */
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
return $instance;
|
||||
}
|
||||
function widget($args, $instance) {
|
||||
extract($args);
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
echo $before_widget;
|
||||
if ($title){echo $before_title . $title . $after_title;}
|
||||
echo do_shortcode('[tw_twitter username="'.$instance['username'].'" tweetstoshow="'.$instance['tweetstoshow'].'" cachetime="'.$instance['cachetime'].'"]');
|
||||
echo $after_widget;
|
||||
}
|
||||
}
|
||||
add_action('widgets_init', create_function('', 'return register_widget("twitterwidget");'));
|
||||
?>
|
Reference in New Issue
Block a user