WordPress.org

Ready to get started?Download WordPress

Forums

Featured image missing fron Blank theme (13 posts)

  1. markomarkogame
    Member
    Posted 1 year ago #

    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 ?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

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

  3. markomarkogame
    Member
    Posted 1 year ago #

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

  4. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Did you review the page I linked to above?

  5. markomarkogame
    Member
    Posted 1 year ago #

    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

  6. LastForOne
    Member
    Posted 1 year ago #

    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.

  7. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    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.

  8. markomarkogame
    Member
    Posted 1 year ago #

    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

  9. markomarkogame
    Member
    Posted 1 year ago #

    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

  10. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

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

  11. markomarkogame
    Member
    Posted 1 year ago #

    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

  12. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

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

  13. markomarkogame
    Member
    Posted 1 year ago #

    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.]

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.