Title: okhalid's Replies | WordPress.org

---

# okhalid

  [  ](https://wordpress.org/support/users/okhalid/)

 *   [Profile](https://wordpress.org/support/users/okhalid/)
 *   [Topics Started](https://wordpress.org/support/users/okhalid/topics/)
 *   [Replies Created](https://wordpress.org/support/users/okhalid/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/okhalid/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/okhalid/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/okhalid/engagements/)
 *   [Favorites](https://wordpress.org/support/users/okhalid/favorites/)

 Search replies:

## Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [How to add a new page to the template?](https://wordpress.org/support/topic/how-to-add-a-new-page-to-the-template/)
 *  Thread Starter [okhalid](https://wordpress.org/support/users/okhalid/)
 * (@okhalid)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/how-to-add-a-new-page-to-the-template/#post-1090144)
 * Found the answer: [http://codex.wordpress.org/Pages](http://codex.wordpress.org/Pages)
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [How to get children categories name](https://wordpress.org/support/topic/how-to-get-children-categories-name/)
 *  Thread Starter [okhalid](https://wordpress.org/support/users/okhalid/)
 * (@okhalid)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/how-to-get-children-categories-name/#post-1089672)
 * This will give me the children of the category 8 right?
 * What I want is that once a post is received belonging to child1, then to get 
   it’s category name as child 1 rather then displaying “root” category name!
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [Automatically reading the first image in an article as a thumbnail](https://wordpress.org/support/topic/automatically-reading-the-first-image-in-an-article-as-a-thumbnail/)
 *  Thread Starter [okhalid](https://wordpress.org/support/users/okhalid/)
 * (@okhalid)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/automatically-reading-the-first-image-in-an-article-as-a-thumbnail/#post-1088082)
 * I have found the solution 🙂
 * [http://wordpress.org/support/topic/246893](http://wordpress.org/support/topic/246893)
 * By adding the function to my functions.php:
 * >  // Get URL of first image in a post
   >  function catch_that_image() { global 
   > $post, $posts; $first_img = ”; ob_start(); ob_end_clean(); $output = preg_match_all(‘/
   > <img.+src=[\'”]([^\'”]+)[\'”].*>/i’, $post->post_content, $matches); $first_img
   > = $matches [1] [0];
   > // no image found display default image instead
   >  if(empty($first_img)){ $first_img
   > = “/images/default.jpg”; } return $first_img; }
 *  I just needed to make the call
 * >  <?php echo catch_that_image() ?>
 *  where I needed. This removed a dependency on external plugins and sorted out
   what I need 🙂
 * Thanks a lot to all those who replied to my bost…
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [Automatically reading the first image in an article as a thumbnail](https://wordpress.org/support/topic/automatically-reading-the-first-image-in-an-article-as-a-thumbnail/)
 *  Thread Starter [okhalid](https://wordpress.org/support/users/okhalid/)
 * (@okhalid)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/automatically-reading-the-first-image-in-an-article-as-a-thumbnail/#post-1088079)
 * I have tried both **gi_library(1)** and **[wp_get_attachment_image( 1 )](http://codex.wordpress.org/Function_Reference/wp_get_attachment_image)**
 * But no luck 🙁
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [Automatically reading the first image in an article as a thumbnail](https://wordpress.org/support/topic/automatically-reading-the-first-image-in-an-article-as-a-thumbnail/)
 *  Thread Starter [okhalid](https://wordpress.org/support/users/okhalid/)
 * (@okhalid)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/automatically-reading-the-first-image-in-an-article-as-a-thumbnail/#post-1088076)
 * Hi,
 * Thanks for the plug-in information. But it didn’t really help. The way the theme
   is designed that it needs custom value “leadimage” to be set. So what i am thinking
   of is that once the simple post thumbnails upload the image, then it automatically
   creates a custom value for the post by setting “leadimage”. I think this will
   sort my issue..
 * Any ideas of about how to do that?
 * Thanks,
    Omer
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Featured Categories Missing](https://wordpress.org/support/topic/featured-categories-missing/)
 *  Thread Starter [okhalid](https://wordpress.org/support/users/okhalid/)
 * (@okhalid)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/featured-categories-missing/#post-1087510)
 * Hi,
 * The link to the Mimbo theme is the following:
    [http://www.darrenhoyt.com/2007/08/05/wordpress-magazine-theme-released/](http://www.darrenhoyt.com/2007/08/05/wordpress-magazine-theme-released/)
 * The error I am getting is this:
 * Warning: Invalid argument supplied for foreach() in /home/public_html/wp/wp-content/
   themes/mimbo/mimbo/index.php on line 88
 * All the post appear in the in their respective categories but nothing appears
   in the featured column.
 * Thanks for your help!
    Omer

Viewing 6 replies - 1 through 6 (of 6 total)