'widget_postloop', 'description' => __( 'Build your own post loop') ); $this->WP_Widget('postloop', __('Post Loop'), $widget_ops); } function widget( $args, $instance ) { extract( $args ); $title = apply_filters('widget_title', empty( $instance['title'] ) ? '' : $instance['title']); $templates = $this->get_templates(); if( 'normal' == $instance['what'] ){ global $wp_query; $ourposts = &$wp_query; }else{ $criteria['suppress_filters'] = TRUE; if( in_array( $instance['what'], array( 'post', 'page', 'attachment' ))) $criteria['post_type'] = $instance['what']; if( !empty( $instance['categories_in'] )) $criteria['category__'. ( in_array( $instance['categoriesbool'], array( 'in', 'and', 'not_in' )) ? $instance['categoriesbool'] : 'in' ) ] = array_keys( $instance['categories_in'] ); if( !empty( $instance['categories_not_in'] )) $criteria['category__not_in'] = array_keys( $instance['categories_not_in'] ); if( !empty( $instance['tags_in'] )) $criteria['tag__'. ( in_array( $instance['tagsbool'], array( 'in', 'and', 'not_in' )) ? $instance['tagsbool'] : 'in' ) ] = $instance['tags_in']; if( !empty( $instance['tags_not_in'] )) $criteria['tag__not_in'] = $instance['tags_not_in']; if( !empty( $instance['post__in'] )) $criteria['post__in'] = $instance['post__in']; if( !empty( $instance['post__not_in'] )) $criteria['post__not_in'] = $instance['post__not_in']; $criteria['showposts'] = $instance['count']; switch( $instance['order'] ){ case 'age_new': $criteria['orderby'] = 'post_date'; $criteria['order'] = 'DESC'; break; case 'age_old': $criteria['orderby'] = 'post_date'; $criteria['order'] = 'ASC'; break; case 'pop_most': case 'pop_least': case 'comment_recent': case 'rand': default: $criteria['orderby'] = 'rand'; break; } $ourposts = new WP_Query( $criteria ); /* $options[$widget_number]['activity'] = in_array( $widget_var['activity'], array( 'pop_most', 'pop_least', 'pop_recent', 'comment_recent', 'comment_few') ) ? $widget_var['activity']: ''; $options[$widget_number]['age'] = in_array( $widget_var['age'], array( 'after', 'before', 'around') ) ? $widget_var['age']: ''; $options[$widget_number]['agestrtotime'] = strtotime( $widget_var['agestrtotime'] ) ? $widget_var['agestrtotime'] : ''; $options[$widget_number]['relationship'] = in_array( $widget_var['relationship'], array( 'similar', 'excluding') ) ? $widget_var['relationship']: ''; $options[$widget_number]['relatedto'] = array_filter( array_map( 'absint', $widget_var['relatedto'] )); */ } if( $ourposts->have_posts() ){ while( $ourposts->have_posts() ){ $ourposts->the_post(); if( !isset( $instance['template'] ) || !include $templates[ $instance['template'] ]['fullpath'] ){ ?>
id="post-">

'); ?> Posted in |

'normal', 'template' => 'a_default_full.php' ) ); $title = esc_attr( $instance['title'] ); ?>

Not in any of these categories

name; } ?>

With none of these tags name; } ?>



FALSE, 'echo' => FALSE, 'hierarchical' => FALSE )); foreach( $items as $item ){ $list[] = '
  • '; } return implode( "\n", $list ); } function control_instances( $self = 0 , $selected = array() ){ if ( !$options = get_option('bsuite_any_posts') ) return FALSE; if( isset( $options[ $self ] )) unset( $options[ $self ] ); $list = array(); foreach( $options as $number => $option ){ $list[] = ''; } return implode( ', ', $list ); } function control_template_dropdown( $default = '' ) { $templates = $this->get_templates(); foreach ($templates as $template => $info ) : if ( $default == $template ) $selected = " selected='selected'"; else $selected = ''; echo "\n\t'; endforeach; } function get_templates_readdir( $template_base ){ $page_templates = array(); $template_dir = @ dir( $template_base ); if ( $template_dir ) { while ( ( $file = $template_dir->read() ) !== false ) { if ( preg_match('|^\.+$|', $file) ) continue; if ( preg_match('|\.php$|', $file) ) { $template_data = implode( '', file( $template_base . $file )); $name = ''; if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) if( function_exists( '_cleanup_header_comment' )) $name = _cleanup_header_comment($name[1]); else $name = $name[1]; if ( !empty( $name ) ) { $file = basename( $file ); $page_templates[ $file ]['name'] = trim( $name ); $page_templates[ $file ]['file'] = basename( $file ); $page_templates[ $file ]['fullpath'] = $template_base . $file; } } } @ $template_dir->close(); } return $page_templates; } function get_templates() { return array_merge( (array) $this->get_templates_readdir( dirname( __FILE__ ) .'/templates-post/' ), (array) $this->get_templates_readdir( TEMPLATEPATH . '/templates-post/' ), (array) $this->get_templates_readdir( STYLESHEETPATH . '/templates-post/' ) ); } }// end bSuite_Widget_Pages /** * Pages widget class * */ class bSuite_Widget_Pages extends WP_Widget { function bSuite_Widget_Pages() { $widget_ops = array('classname' => 'widget_pages', 'description' => __( 'A buncha yo blog’s WordPress Pages') ); $this->WP_Widget('pages', __('Pages'), $widget_ops); } function widget( $args, $instance ) { extract( $args ); $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title']); $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby']; $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude']; $depth = isset( $instance['depth'] ) ? $instance['depth'] : 1; if ( $sortby == 'menu_order' ) $sortby = 'menu_order, post_title'; $out = wp_list_pages( array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude, 'depth' => $depth )); if( $instance['expandtree'] && is_page() ){ global $post; // get the ancestor tree, including the current page $ancestors = $post->ancestors; $ancestors[] = $post->ID; $pages = get_pages( array( 'include' => implode( ',', $ancestors ))); if ( !empty( $pages )){ $subtree .= walk_page_tree( $pages, 0, $post->ID, array() ); // get any children, insert them into the tree if( $children = wp_list_pages( array( 'child_of' => $post->ID, 'title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude, 'depth' => $depth ))){ $subtree = preg_replace( '/current_page_item[^<]*'. $children .'', $subtree ); } // insert this extended page tree into the larger list if( !empty( $subtree )){ $out = preg_replace( '/]*page-item-'. ( count( $post->ancestors ) ? end( $post->ancestors ) : $post->ID ) .'[^>]*.*?<\/li>.*?($|ancestors ); } } } if ( !empty( $out ) ) { echo $before_widget; if ( $title) echo $before_title . $title . $after_title; ?>
    'post_title', 'title' => '', 'exclude' => '', 'depth' => 1, 'expandtree' => 1) ); $title = esc_attr( $instance['title'] ); $exclude = esc_attr( $instance['exclude'] ); ?>

    />