• I have the following code:

    <?php
      query_posts('showposts=3&cat=15');
      while (have_posts()) : the_post();
        ( Display title, image and some text. )
      endwhile;
    ?>

    This should show 3 posts right? Then why is it showing 2?
    I’ve also tried setting it to display 4 posts. It displayes 4 for a while, then sudenly it jus tshows 3…..

    You can see the effect here: https://www.norwegianfashion.no. Under the column NYHETER, there are only 2 “boxed” articles. Should be 3….

    Here is the entire code

    query_posts('showposts=3&cat=15'); ?>
        <h3> Nyheter  </h3>
        <?php while (have_posts()) : the_post();
    
        	$main_article = get_post_custom_values("main_article");
      	  $related_image_url = get_post_custom_values("related_image");
      	  $related_alternate_image_url = get_post_custom_values("alternative_image");
          $imgTitle = get_post_custom_values("image_title");
          $imgUrl = '';
          $imgHtml = '';    
    
           //If an alternate image is used, this will be used as thumbnail
          if (!empty($related_alternate_image_url[0]))
             $imgUrl = $related_alternate_image_url[0];
          else
             $imgUrl = $related_image_url[0];
    
          // Create image URL and add image text if it exsists
          // Identifies if the URL is for an external image or local image
    
          if (stristr($imgUrl, 'https://') == true){
          	$imgHtml = '<img src="' . $imgUrl .'" alt="' . $imgTitle[0] . '" />';
          }
          else {
          	$imgHtml = '<img src="' . get_option('home') . '/wp-content/uploads' . $imgUrl .'" alt="' . $imgTitle[0] . '" />';
          }
    
        	//Display all aticles which is not main article
          //Warning! Must manually make sure thre is only one main article, unless the article is to dissappear.
        	if(empty($main_article[0])):
    
          	echo '<div class="feature">';
        		if(!empty($imgHtml))
        		{
        	  	echo '<a href="' . $permaLink . '">';
        	  	echo $imgHtml;
        	  	echo '</a>';
        	  }
    
          	echo '<a href="' . get_permalink() . '" class="title">';
            echo the_title(); echo '<br />';
            echo '</a>'; ?>
            <span>(<?php the_time('d.m.y'); ?>) </span>
            <?php
            echo the_content_rss('Les mer','', '', 20);
            echo '<a href="' . get_permalink() . '">Les mer</a>';
            echo '<div class="clearfloat"></div>';
            echo '</div>';
          endif;
        endwhile;
  • The topic ‘That’s weird…..’ is closed to new replies.