function widget($args, $instance) { extract($args); $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); $limit = is_numeric($instance['limit']) ? $instance['limit'] : 5; $orderby = $instance['orderby'] ? $instance['orderby'] : 'date'; $order = $instance['order'] ? $instance['order'] : 'desc'; $exclude = $instance['exclude'] != '' ? $instance['exclude'] : 0; $excludeposts = $instance['excludeposts'] != '' ? $instance['excludeposts'] : 0; $offset = is_numeric($instance['offset']) ? $instance['offset'] : 0; $category_id = $instance['categoryid']; $dateformat = $instance['dateformat'] ? $instance['dateformat'] : get_option('date_format'); $showdate = $instance['show_date'] == 'on' ? 'yes' : 'no'; $showexcerpt = $instance['show_excerpt'] == 'on' ? 'yes' : 'no'; $excerptsize = empty($instance['excerpt_size']) ? 55 : $instance['excerpt_size']; $showauthor = $instance['show_author'] == 'on' ? 'yes' : 'no'; $showcatlink = $instance['show_catlink'] == 'on' ? 'yes' : 'no'; $thumbnail = $instance['thumbnail'] == 'on' ? 'yes' : 'no'; $thumbnail_size = $instance['thumbnail_size'] ? $instance['thumbnail_size'] : 'thumbnail'; $morelink = empty($instance['morelink']) ? ' ' : $instance['morelink']; $atts = array('id' => $category_id, 'orderby' => $orderby, 'order' => $order, 'numberposts' => $limit, 'date' => $showdate, 'author' => $showauthor, 'dateformat' => $dateformat, 'template' => 'default', 'excerpt' => $showexcerpt, 'excerpt_size' => $excerptsize, 'exclude' => $exclude, 'excludeposts' => $excludeposts, 'offset' => $offset, 'catlink' => $showcatlink, 'thumbnail' => $thumbnail, 'thumbnail_size' => $thumbnail_size, 'morelink' => $morelink); echo $before_widget; if ($title == 'catlink') { //if the user has setup 'catlink' as the title, replace it with the category link: $lcp_category = get_category($category_id); $title = '<a href="' . get_category_link($lcp_category->cat_ID) . '">' . $lcp_category->name . '</a>'; } echo $before_title . $title . $after_title; $catlist_displayer = new CatListDisplayer($atts); echo $catlist_displayer->display(); echo $after_widget; }
function widget($args, $instance) { extract($args); $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); $limit = is_numeric($instance['limit']) ? $instance['limit'] : 5; $orderby = $instance['orderby'] ? $instance['orderby'] : 'date'; $order = $instance['order'] ? $instance['order'] : 'desc'; $exclude = $instance['exclude'] != '' ? $instance['exclude'] : 0; $excludeposts = $instance['excludeposts'] != '' ? $instance['excludeposts'] : 0; $offset = is_numeric($instance['offset']) ? $instance['offset'] : 0; $category_id = $instance['categoryid']; $dateformat = $instance['dateformat'] ? $instance['dateformat'] : get_option('date_format'); $showdate = $instance['show_date'] == 'on' ? 'yes' : 'no'; $showexcerpt = $instance['show_excerpt'] == 'on' ? 'yes' : 'no'; $showauthor = $instance['show_author'] == 'on' ? 'yes' : 'no'; $showcatlink = $instance['show_catlink'] == 'on' ? 'yes' : 'no'; $thumbnail = $instance['thumbnail'] == 'on' ? 'yes' : 'no'; $thumbnail_size = $instance['thumbnail_size'] ? $instance['thumbnail_size'] : 'thumbnail'; $morelink = empty($instance['morelink']) ? ' ' : $instance['morelink']; echo $before_widget; echo $before_title . $title . $after_title; $atts = array('id' => $category_id, 'orderby' => $orderby, 'order' => $order, 'numberposts' => $limit, 'date' => $showdate, 'author' => $showauthor, 'dateformat' => $dateformat, 'template' => 'default', 'excerpt' => $showexcerpt, 'exclude' => $exclude, 'excludeposts' => $excludeposts, 'offset' => $offset, 'catlink' => $showcatlink, 'thumbnail' => $thumbnail, 'thumbnail_size' => $thumbnail_size, 'morelink' => $morelink); $catlist_displayer = new CatListDisplayer($atts); echo $catlist_displayer->display(); echo $after_widget; }
/** * Gets the shortcode parameters and instantiate plugin objects * @param $atts * @param $content */ static function catlist_func($atts, $content = null) { $atts = shortcode_atts(array('id' => '0', 'name' => '', 'orderby' => 'date', 'order' => 'desc', 'numberposts' => '5', 'date' => 'no', 'date_tag' => '', 'date_class' => '', 'dateformat' => get_option('date_format'), 'author' => 'no', 'author_tag' => '', 'author_class' => '', 'template' => 'default', 'excerpt' => 'no', 'excerpt_size' => '55', 'excerpt_strip' => 'yes', 'excerpt_overwrite' => 'no', 'excerpt_tag' => '', 'excerpt_class' => '', 'exclude' => '0', 'excludeposts' => '0', 'offset' => '0', 'tags' => '', 'exclude_tags' => '', 'content' => 'no', 'content_tag' => '', 'content_class' => '', 'catlink' => 'no', 'catlink_string' => '', 'catlink_tag' => '', 'catlink_class' => '', 'comments' => 'no', 'comments_tag' => '', 'comments_class' => '', 'thumbnail' => 'no', 'thumbnail_size' => 'thumbnail', 'thumbnail_class' => '', 'title_tag' => '', 'title_class' => '', 'post_type' => '', 'post_status' => '', 'post_parent' => '0', 'post_suffix' => '', 'class' => 'lcp_catlist', 'customfield_name' => '', 'customfield_value' => '', 'customfield_display' => '', 'customfield_orderby' => '', 'taxonomy' => '', 'categorypage' => '', 'category_count' => '', 'morelink' => '', 'morelink_class' => '', 'morelink_tag' => '', 'posts_morelink' => '', 'posts_morelink_class' => '', 'year' => '', 'monthnum' => '', 'search' => '', 'link_target' => '', 'pagination' => 'no', 'instance' => '0'), $atts); if ($atts['pagination'] == 'yes') { lcp_pagination_css(); } $catlist_displayer = new CatListDisplayer($atts); return $catlist_displayer->display(); }
/** * Gets the shortcode parameters and instantiate plugin objects * @param $atts * @param $content */ static function catlist_func($atts, $content = null) { $atts = shortcode_atts(array('id' => '0', 'name' => '', 'orderby' => '', 'order' => '', 'numberposts' => '', 'date' => 'no', 'date_tag' => '', 'date_class' => '', 'dateformat' => get_option('date_format'), 'date_modified' => '', 'date_modified_tag' => '', 'date_modified_class' => '', 'author' => 'no', 'author_posts_link' => 'no', 'author_tag' => '', 'author_class' => '', 'author_posts' => '', 'template' => '', 'excerpt' => 'no', 'excerpt_size' => '55', 'excerpt_strip' => 'yes', 'excerpt_overwrite' => 'no', 'excerpt_tag' => '', 'excerpt_class' => '', 'exclude' => '0', 'excludeposts' => '0', 'offset' => '0', 'tags' => '', 'exclude_tags' => '', 'currenttags' => '', 'content' => 'no', 'content_tag' => '', 'content_class' => '', 'display_id' => 'no', 'catlink' => 'no', 'catname' => 'no', 'catlink_string' => '', 'catlink_tag' => '', 'catlink_class' => '', 'child_categories' => 'yes', 'comments' => 'no', 'comments_tag' => '', 'comments_class' => '', 'starting_with' => '', 'thumbnail' => 'no', 'thumbnail_size' => 'thumbnail', 'thumbnail_class' => '', 'force_thumbnail' => '', 'title_tag' => '', 'title_class' => '', 'title_limit' => '0', 'post_type' => '', 'post_status' => '', 'post_parent' => '0', 'post_suffix' => '', 'show_protected' => 'no', 'class' => 'lcp_catlist', 'conditional_title' => '', 'conditional_title_tag' => '', 'conditional_title_class' => '', 'customfield_name' => '', 'customfield_value' => '', 'customfield_display' => '', 'customfield_display_glue' => '', 'customfield_display_name' => '', 'customfield_display_name_glue' => ' : ', 'customfield_display_separately' => 'no', 'customfield_orderby' => '', 'customfield_tag' => '', 'customfield_class' => '', 'taxonomy' => '', 'terms' => '', 'categorypage' => '', 'category_count' => '', 'category_description' => 'no', 'morelink' => '', 'morelink_class' => '', 'morelink_tag' => '', 'posts_morelink' => '', 'posts_morelink_class' => '', 'year' => '', 'monthnum' => '', 'search' => '', 'link_target' => '', 'pagination' => 'no', 'pagination_next' => '>>', 'pagination_prev' => '<<', 'no_posts_text' => "", 'instance' => '0', 'no_post_titles' => 'no', 'link_titles' => true, 'link_dates' => 'no'), $atts); if ($atts['numberposts'] == '') { $atts['numberposts'] = get_option('numberposts'); } if ($atts['pagination'] == 'yes' || get_option('lcp_pagination') === 'true' && $atts['pagination'] !== 'false') { lcp_pagination_css(); } $catlist_displayer = new CatListDisplayer($atts); return $catlist_displayer->display(); }
"> <?php _e("Template", 'list-category-posts'); ?> : </label> <br/> <select id="<?php echo $this->get_field_id('template'); ?> " name="<?php echo $this->get_field_name('template'); ?> "> <?php $templates = CatListDisplayer::get_templates(); $templates[] = 'default'; foreach ($templates as $tmp) { $option = '<option value="' . $tmp . '" '; if ($tmp == $template) { $option .= ' selected = "selected" '; } $option .= '">'; $option .= $tmp; $option .= '</option>'; echo $option; } ?> </select> </p>
/** * Gets the shortcode parameters and instantiate plugin objects * @param $atts * @param $content */ function catlist_func($atts, $content = null) { $atts = shortcode_atts(array('id' => '0', 'name' => '', 'orderby' => 'date', 'order' => 'desc', 'numberposts' => '5', 'date' => 'no', 'date_tag' => '', 'date_class' => '', 'dateformat' => get_option('date_format'), 'author' => 'no', 'author_tag' => '', 'author_class' => '', 'template' => 'default', 'excerpt' => 'no', 'excerpt_size' => '255', 'excerpt_tag' => '', 'excerpt_class' => '', 'exclude' => '0', 'excludeposts' => '0', 'offset' => '0', 'tags' => '', 'content' => 'no', 'content_tag' => '', 'content_class' => '', 'catlink' => 'no', 'catlink_string' => '', 'catlink_tag' => '', 'catlink_class' => '', 'comments' => 'no', 'comments_tag' => '', 'comments_class' => '', 'thumbnail' => 'no', 'thumbnail_size' => 'thumbnail', 'thumbnail_class' => '', 'title_tag' => '', 'title_class' => '', 'post_type' => '', 'post_parent' => '0', 'class' => 'lcp_catlist', 'customfield_name' => '', 'customfield_value' => '', 'customfield_display' => '', 'taxonomy' => '', 'categorypage' => '', 'morelink' => '', 'morelink_class' => ''), $atts); $catlist_displayer = new CatListDisplayer($atts); return $catlist_displayer->display(); }