Feature Image on Posts

Homepage Community Forums Epik Theme Support Feature Image on Posts

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #10338
    Michael
    Customer

      I would like the featured image to show up on individual posts pages. Currently it only shows in the indexed area of blog posts but not individual posts.

      thanks

      #10348
      Wes
      Moderator

        Yeah that’s the way it’s designed in Genesis by default. I’m sure there is a way to get the featured image to show up on Posts, but I can’t find the code at the moment.

        One way to get around it is to add the same image inside of your Content area…..but depending how you have your blog setup, it could show double images if you don’t have a content limit set.

        If I come across the code needed to add the featured image to the posts I’ll let you know.

        #10354
        Michael
        Customer

          Thanks Wes.

          What about this block of code?

          add_action( ‘genesis_entry_header’, ‘genesis_do_single_post_image’ ); // this is for HTML5 hook
          add_action( ‘genesis_before_post_title’, ‘genesis_do_single_post_image’ ); // This is for Pre-HTML5 hook
          function genesis_do_single_post_image() {

          if ( is_single() ) {
          $img = genesis_get_image( array(
          ‘format’ => ‘html’,
          ‘size’ => genesis_get_option( ‘image_size’ ),
          ‘context’ => ‘archive’,
          ‘attr’ => genesis_parse_attr( ‘entry-image’ ),
          ) );

          if ( ! empty( $img ) )
          printf( ‘%s‘, get_permalink(), the_title_attribute( ‘echo=0’ ), $img );
          }

          }

          I would still need to call the function in the correct template. Can you direct me there?

          Thanks again

          #10358
          Wes
          Moderator

            That code didn’t work for me, it just added the link to the image, but not the image itself.

            I’m guessing you would need to add it to the functions file…either that or create a single.php file but I don’t know for sure. If we can’t figure it out here, try posting in the SP forums since there are more developers there that may know how to do it. Since it’s dealing with the Genesis Framework the solution should work for all child themes.

            #13268
            anehra75
            Customer

              I just added this to functions.php and it works:

              // Code to Display Featured Image on top of the post
              add_action( ‘genesis_entry_content’, ‘featured_post_image’, 8 );
              function featured_post_image() {
              if ( ! is_singular( ‘post’ ) ) return;
              the_post_thumbnail(‘post-image’);
              }

              Just need to fix css spacing at the bottom of the image, but otherwise perfect.

              #13270
              anehra75
              Customer

                Add this CSS to give the in-post featured image the same formatting as in the blog index;

                /*—-Featured Image in Post—-*/
                img.attachment-post-image.wp-post-image {
                margin-bottom: 24px;
                margin-right: 24px;
                }

                #14506
                jasonhjh
                Customer

                  Didn’t work for me Anehra. I’m using the epik theme – any idea how I can modify the code to make it work?

                Viewing 7 posts - 1 through 7 (of 7 total)
                • The topic ‘Feature Image on Posts’ is closed to new replies.