?> "><?php echo $sub_cat->name; ?> </a>»</h2> <?php if ($cat_query->have_posts()) { while ($cat_query->have_posts()) { $cat_query->the_post(); $no_duplicates[] = $post->ID; ?> <div class="clear"> <?php if (function_exists("ufandshands_post_thumbnail")) { ufandshands_post_thumbnail('thumbnail', 'alignleft', 150, 150); } ?> <h3><a href="<?php the_permalink(); ?> " rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?> "><?php the_title(); ?> </a></h3> <p class="published black-50">Published: <?php the_time('M jS, Y'); ?>
function widget($args, $instance) { extract($args, EXTR_SKIP); $unique_page_content = get_page_by_title($instance['unique_page_id']); global $wp_query; $current_page = $wp_query->post->ID; if ($current_page == $unique_page_content->ID || empty($instance['unique_page_id'])) { echo $before_widget; $title = empty($instance['title']) ? '' : apply_filters('widget_title', urldecode($instance['title'])); $numberofposts = empty($instance['numberofposts']) ? ' ' : apply_filters('widget_numberofposts', $instance['numberofposts']); $recent_news_alt_url = empty($instance['recent_news_alt_url']) ? '' : apply_filters('widget_text', $instance['recent_news_alt_url']); $showexcerpt = $instance['showexcerpt'] === 'true' || $instance['showexcerpt'] === 'on' ? true : false; $showthumbnails = $instance['showthumbnails'] === 'true' || $instance['showthumbnails'] === 'on' ? true : false; $showdate = $instance['showdate'] === 'true' || $instance['showdate'] === 'on' ? true : false; $showrssicon = $instance['showrssicon'] === 'true' || $instance['showrssicon'] === 'on' ? true : false; $featured_content_category = of_get_option("opt_featured_category"); if (!empty($instance['specific_category_id'])) { $specific_category_id_actual = "&cat="; $specific_category_id_actual .= get_cat_id($instance['specific_category_id']); } if ($showrssicon == "on") { $iconpath = get_bloginfo('template_url') . '/images/rss.png'; $showrssiconimage = "<a href='" . get_bloginfo('rss2_url') . "' title='Subscribe to RSS feed'><img class='rss-icon' src='" . $iconpath . "' class='rss_icon' alt='Subscribe to RSS Feed'/></a> "; } if (empty($recent_news_alt_url)) { //Check if Single category is selected //Old method for storing single specific category if (!is_array($instance['specific_category_id'])) { $recent_news_link = esc_url(strip_tags(get_category_link(get_cat_id($instance['specific_category_id'])))); } else { if (is_array($instance['specific_category_id'])) { if (count($instance['specific_category_id']) === 1) { $first_cat = $instance['specific_category_id']; $recent_news_link = get_category_link($first_cat[0]); } else { //URL for multiple categories? //Currently defaults back to /category/news/ or /category/uncategorized/ for multiple } } } //If 'All Categories' is selected (or Categories left blank), link the title to the 'News' category if it exists, otherwise link to 'Uncategorized' category if (empty($recent_news_link)) { if (function_exists('of_get_option')) { $posts_path = of_get_option('opt_custom_posts_path'); } if (!empty($posts_path)) { $recent_news_link = "<a href='{$posts_path}'>"; } else { $term = term_exists('News', 'category'); if ($term !== 0 && $term !== null) { $recent_news_link = "<a href=\"" . get_category_link(get_cat_id('News')) . "\">"; } else { $recent_news_link = "<a href=\"" . get_category_link(get_cat_id('Uncategorized')) . "\">"; } } } else { $recent_news_link = "<a href='{$recent_news_link}'>"; } } else { //Use custom Title URL $recent_news_link_alt = esc_url(strip_tags($recent_news_alt_url)); $recent_news_link = "<a href='{$recent_news_link_alt}'>"; } if (!empty($recent_news_link)) { $recent_news_link_a = "</a>"; } else { $recent_news_link_a = ''; } if (empty($title)) { $title = 'Recent News'; } echo $before_title . $recent_news_link . $title . $recent_news_link_a . $showrssiconimage . $after_title; $post_args = array('showposts' => $numberofposts, 'post_status' => 'publish', 'cat' => $final_categories); if (is_front_page()) { $post_args['category__not_in'] = $featured_content_category; } $recentPosts = new WP_Query(); $recentPosts->query("showposts=" . $numberofposts . "&cat=-" . $featured_content_category . $specific_category_id_actual . ""); while ($recentPosts->have_posts()) { $recentPosts->the_post(); global $post; $margin = ''; echo "<div id='recent-posts' class='news-announcements'><div class='item'>"; if ($showthumbnails) { if (ufandshands_post_thumbnail('thumbnail', 'alignleft', 150, 150)) { $margin = "margin-160"; } } if (empty($showexcerpt)) { $margin_bottom = 'margin_bottom_none'; } echo "<h4><a href=\"" . get_permalink() . "\">" . get_the_title() . "</a></h4>"; if ($showdate) { echo "<p class='time {$margin} {$margin_bottom}'>" . get_the_time('M jS, Y') . "</p>"; } if ($showexcerpt) { echo "<p>" . get_the_excerpt() . "</p>"; } //if ($showthumbnails){ echo "<div style=\"clear:right;\"></div>"; } -- disabled -- not sure if needed in new UF&Shands template // echo "<div class=\"recent_post_container_bottom_border\"></div>"; -- disabled -- not sure if needed in new UF&Shands template echo "</div></div>"; } wp_reset_query(); echo $after_widget; } else { return false; } }