/** * Displays category posts widget on blog. */ function widget($args, $instance) { global $post, $wp_query; extract($args); // If not title, use the name of the category. if (!$instance["title"]) { $category_info = get_category($instance["cat"]); $instance["title"] = $category_info->name; } // Get array of post info. $cat_posts = new WP_Query("showposts=" . $instance["num"] . "&cat=" . $instance["cat"]); echo $before_widget; // Widget title echo $before_title; if ((bool) $instance["title_link"]) { echo '<a href="' . get_category_link($instance["cat"]) . '">' . $instance["title"] . '</a>'; } else { echo $instance["title"]; } echo $after_title; // Post list echo "<ul>\n"; while ($cat_posts->have_posts()) { $cat_posts->the_post(); ?> <li class='cat-post-item'> <?php if ((bool) $instance["thumbnail"] && function_exists('p75HasThumbnail') && p75HasThumbnail($cat_posts->post->ID)) { ?> <a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><img class='alignleft' src='<?php echo p75GetThumbnail($post->ID, $instance["thumbnail_width"], $instance["thumbnail_height"]); ?> ' alt='<?php the_title_attribute(); ?> ' /></a> <?php } // end thumbnail function check ?> <a class="post-title" href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php the_title(); ?> </a> <?php if ($instance['excerpt']) { the_excerpt(); } ?> </li> <?php } echo "</ul>\n"; echo $after_widget; }
<?php $version = bnc_get_wp_version(); if ($version >= 2.9 && $wptouch_settings['post-cal-thumb'] != 'calendar-icons' && $wptouch_settings['post-cal-thumb'] != 'nothing-shown') { ?> <div class="wptouch-post-thumb-wrap"> <div class="thumb-top-left"></div><div class="thumb-top-right"></div> <div class="wptouch-post-thumb"> <?php if (function_exists('p75GetThumbnail')) { if (p75HasThumbnail($post->ID)) { ?> <img src="<?php echo p75GetThumbnail($post->ID); ?> " alt="post thumbnail" /> <?php } else { ?> <?php $total = '24'; $file_type = '.jpg'; // Change to the location of the folder containing the images $image_folder = '' . compat_get_plugin_url('wptouch') . '/themes/core/core-images/thumbs/'; $start = '1'; $random = mt_rand($start, $total); $image_name = $random . $file_type; if ($wptouch_settings['post-cal-thumb'] == 'post-thumbnails-random') {
function classic_the_post_thumbnail($thumbnail) { global $post; $settings = wptouch_get_settings(); $custom_field_name = $settings->classic_custom_field_thumbnail_name; switch ($settings->classic_icon_type) { case 'thumbnails': if (function_exists('has_post_thumbnail') && has_post_thumbnail()) { return $thumbnail; } break; case 'simple_thumbs': if (function_exists('p75GetThumbnail') && p75HasThumbnail($post->ID)) { return p75GetThumbnail($post->ID); } break; case 'custom_thumbs': if (get_post_meta($post->ID, $custom_field_name, true)) { return get_post_meta($post->ID, $custom_field_name, true); } else { if (get_post_meta($post->ID, 'Thumbnail', true)) { return get_post_meta($post->ID, 'Thumbnail', true); } else { if (get_post_meta($post->ID, 'thumbnail', true)) { return get_post_meta($post->ID, 'thumbnail', true); } } } break; } // return default if none of those exist return wptouch_get_bloginfo('template_directory') . '/images/default-thumbnail.png'; }