Support » Fixing WordPress » How do I add featured image support to any theme?

  • Online i find themes all the time that i like. Unfortunately too often they do not support featured images on the homepage or even on the article. How can i add featured support to any theme?

    I have seen articles, but they seem to be written for a particular theme. So I need to know how to do it on any theme. Also, is there a plugin that does this for me. I’ve tried “Get The Image” but that didn’t seem to do anything.

    I’m currently trying Black Board 1.1.2 by Frank Schrijvers

Viewing 15 replies - 1 through 15 (of 23 total)
  • Review Post_Thumbnails.

    This talks about it, but doesnt tell me how to do it. i tried just copy and pasting the code in but it doesnt do anything.

    I used these generic directions I found via Google to successfully add featured image support to an older theme.

    Did you start by adding in theme support via functions.php?

    add_theme_support( 'post-thumbnails' );

    I tried adding that code and nothing happened. Part of the problem is that it tell me to put the code in the loop.php But most of the themes ive seen dont have a loop.php.

    How can I tell which php is the looop?

    Anyone? I still can’t figure it out

    (BTW, I don’t know PHP myself but gleaned enough information to get post thumbnails working in a theme that didn’t support the feature.)

    In a nutshell, The Loop isn’t a stand alone PHP script per se. It’s a section of code that WordPress uses to format and display posts and it’s called repeatedly in a loop while there are posts left to be displayed.

    Typically, this section of code is located in the “index.php” file of your current theme as well as any other template file that’s used to display a post to the user.

    This link in the WordPress Codex explains the Loop in action.

    I tried to follow the directions but i got and error that took down the entire wp gui.
    Parse error: syntax error, unexpected ‘<‘

    Is there anyone out there willing to walk me through this. I’m currently using gamezone theme. Once I learn how to do it for 1 theme Im sure i can do it for others.

    that error usually means you inserted php code inside of php code.

    gamezone isn’t in the WP theme repository, so I can’t look at it. But you can’t put php code inside php code.

    <?php code
    more code
    <?php adding php code here with opening and closing tags is invalid ?>

    you do it before or after

    <?php code
    more code
    <?php you can add code after like this ?>

    I reset the theme back to default.
    And here is a link to the theme.

    I’d appreciate your help Rev. Voodoo


    I managed to get Gamezone to use WordPress’ post thumbnails feature.

    I’d rather defer to someone who really knows PHP but I’ll post my findings anyway in case you want to play around with it yourself.

    This example involves Gamezone’s index.php file.

    Gamezone loads thumbnails via URLs that are set by the blogger using Custom Fields and assigns the thumbnail URL to a variable called $screen:

    <?php $screen = get_post_meta($post->ID,'screen', true); ?>

    It then embeds that URL inside an img HTML tag:

    <img src="<?php echo ($screen); ?>" width="80" height="55" alt="" />

    After some Google-fu and checking out some entries in the WordPress Codex, I replaced this:

    <?php $screen = get_post_meta($post->ID,'screen', true); ?>

    With this:

    <?php $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,’thumbnail’, true); ?>

    What it does is fetch the ID of the thumbnail that’s attached to the post and assigns it to $image_id to be used later as a required parameter.

    Then it gets the URL of the actual post thumbnail using wp_get_attachment_image_src and assigns it to $image_url. Note that wp_get_attachment_image_src requires an ID, which is provided by $image_id that we assigned earlier.

    Then I replaced this:

    <img src="<?php echo ($screen); ?>" width="80" height="55" alt="" />

    With this:

    <img src="<?php echo $image_url[0]; ?>" width="80" height="55" alt="" />

    They do the same thing (I.e. Embed the URL of the thumbnail inside of the IMG HTML tag using php echo.) except that the replacement code uses the URL derived from wp_get_attachment_image_src.

    I installed Gamezine on a defunct blog that was updated to WP v3.0.4, added a few featured images to some random posts, tested the new code and it worked. Gamezone theme was using post thumbnails set within WordPress.

    I noticed that the Featured Posts slider would not function properly under Firefox, Chrome or Safari. Since I hadn’t made any changes to the glide.php script that controls it, this could be a theme issue.

    Since I don’t know PHP, that’s about as far as I go. As mentioned, I defer to those with PHP experience. I thought I’d take a crack at it anyway for what it’s worth.

    o_O Wow man thanks for the help I’m going to go try this out.

    But if every theme using custom variables to load images how am I as a noob supposed to know what I’m looking for in other themes?

    It’s a darn shame that it somehow kills the Slider.

    Isn’t there just a way to only instead it into the page and not affect the rest of the theme?

    Whoa, stop the presses… I think I might have screwed up.

    I may have confused the themes. I have one called Gamezone and Gamezine.

    Aw, crap! Lemme get back to you. 😛

    EDIT: Oh man, I am SO embarrassed. I spent all that time fixing a theme called GameZINE so featured images would work with it. You needed help with Game ZONE.


    Lol… I put a link on one of my posts.
    Here it is

    That’s why I feel so stupid right now. X-D

    I actually used the link in your post to visit the GameZone theme site but I can’t explain how I ended up with GamezIne installed. 😛

    What were you looking to do with the Gamezone (with an “O” ;-D) theme?

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘How do I add featured image support to any theme?’ is closed to new replies.