Support » Themes and Templates » Featured image missing fron Blank theme

  • markomarkogame

    (@markomarkogame)


    So i think that featured image in WordPress is a key element, atleast if your doing a portal/news website with WordPress. But then I noticed since im working on a new website that Blank theme by Chris Coyer is missing a feature: Featured image, when I go into posts i dont have that option on the right side.

    How do i enable that feature also what more key elements am I missing ?

Viewing 12 replies - 1 through 12 (of 12 total)
  • esmi

    (@esmi)

    Forum Moderator

    Where did you download this theme from? Have you reviewed http://codex.wordpress.org/Function_Reference/the_post_thumbnail

    markomarkogame

    (@markomarkogame)

    From here It’s from 2010 so I’m wondering what am I missing and what should I add (whats mandatory)

    esmi

    (@esmi)

    Forum Moderator

    Did you review the page I linked to above?

    markomarkogame

    (@markomarkogame)

    Yes, thanks for the link.

    So i need to add a peace of code to functions.php and then
    add the php/html code where i want featured post to show up ? 🙂

    There was a lot of code on the page, but I guess I add this code to functions.php

    <?php the_post_thumbnail( $size, $attr ); ?>

    Correct me if I’m wrong

    add_theme_support( 'post-thumbnails' ); this is what you need to include in your function.php to enable post-thumbails, and go through the esmi’s link for more info on how to retrieve and show the thumbnails.

    esmi

    (@esmi)

    Forum Moderator

    What @LastForOne said. 🙂 Personally, I’d just start with off with using <?php the_post_thumbnail(); ?> in your theme’s template files and see how that goes.

    markomarkogame

    (@markomarkogame)

    Alright thanks, did it.
    Now if I want my featured image to be linked to a post in which it was placed where do I add this:

    add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );
    
    function my_post_image_html( $html, $post_id, $post_image_id ) {
    
      $html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '">' . $html . '</a>';
      return $html;
    
    }

    [Please post code snippets between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    Thanks once more

    markomarkogame

    (@markomarkogame)

    After I added
    add_theme_support( ‘post-thumbnails’ ); i have the option for Featured image. Also added background image option in Functions and it works also

    esmi

    (@esmi)

    Forum Moderator

    What exactly are you trying to do? What kind of page are you trying to create?

    markomarkogame

    (@markomarkogame)

    For example
    http://worldoftanks.com/

    Look at the middle of site section: News

    There is the image in the left corner (Featured image in our wordpress) and title on the right side.

    The image links to the post/title. Thats what i want to have enabled and i thought the code above would get me to that to work

    esmi

    (@esmi)

    Forum Moderator

    So this is for your site’s main posts page, yes?

    markomarkogame

    (@markomarkogame)

    Yes, but I want to use featured also on single.php. I guess the core code will be the same for it to be able to show up

    [No bumping – especially after less than 1 hour! If it’s that urgent, consider hiring someone.]

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Featured image missing fron Blank theme’ is closed to new replies.