2011-07-24 16 views
0

我創建類別圖像縮略圖,在這裏我想要哪個帖子沒有圖像的帖子是退出();這裏是我的代碼找到後圖像,但如何可以退出不具有圖像的特定帖子。 PLZ指定我。Wordpress退出定義Post?

 <?php //found the images from the post content 
      global $post, $posts; 
      $postContent = $post->post_content; 
      $searchimages = '~<img [^>]* />~'; 

      preg_match_all($searchimages, $postContent, $post_imgs); 

      // Check to see if we have at least 1 image 
      $findImages = count($post_imgs[0]); 

      if ($findImages > 0) { 
      echo "found"."<br />"; 

      } else { 
      echo "not found"."<br />"; 
      } 
     ?> 

在這裏,我定義沒有找到,但我想這個沒有發現帖子是退出;

回答

0

如果通過退出,你的意思是退出大括號(的if/else語句),使用一個簡單的休息;功能。