• Hi

    I have this function in my theme:

    //my functions
    function getThumbs($amount) {
    
    	echo "<div id=\"media-gallery\">\n";
    	echo "<h2>Media Gallery</h2>\n";
    	echo "<ul>\n";
    
     			query_posts('showposts=' . $amount . '&cat=1,6&orderby=rand');
    
    				while (have_posts()) : the_post(); 
    
    					$category = get_the_category(); 
    
    					if ( in_category('6') ) {
    						$catnicename = "showreel";
    						$custom_fields = get_post_custom();
    				     	$images = $custom_fields['showreel_thumbnail'];
    					} else {
    						$catnicename = $category[0]->category_nicename;
    						$custom_fields = get_post_custom();
    				     	$images = $custom_fields['image_url'];
    					}
    				  		  if(is_array($images))	{
    				    		foreach ( $images as  $value )
    
    							if ( in_category('6') ) {
    										echo "<li><a href=\"";
    										the_permalink();
    										echo "\"><img src=\"";
    										echo str_replace(".jpg", ".gif", $value);
    										echo "\" alt=\"" . get_the_title() . "\" /></a></li>\n";
    							} else {
    									echo "<li><a href=\"";
    									the_permalink();
    									echo "\"><img src=\"/image/galleries/";
    									echo $catnicename;
    									if (!isset($listOnly)){
    										echo "/frontpage/";
    									} else {
    										echo "/largeThumbs/";
    									}
    									echo $value;
    									echo "\" alt=\"" . get_the_title() . "\" /></a></li>\n";
    							}
    
    							}
    				endwhile;
    		echo "</ul>\n";
    			echo "</div>";
    }

    Which i call using:

    <?php if (function_exists('getThumbs')) getThumbs(55); ?>

    It behaves… oddly, usually returning 55 posts, but sometimes 56!

    Any ideas why?

    Can be seen here: https://davidswain.co.uk, click refresh a few times.. Doesnt do it on the localhost, just the webserver!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Showposts being “odd:’ is closed to new replies.