Community Forums › Forums › Archived Forums › Design Tips and Tricks › Featured image not working in Corporate theme?
- This topic has 11 replies, 2 voices, and was last updated 9 years, 8 months ago by Anita.
-
AuthorPosts
-
July 17, 2014 at 8:51 am #114657gswartzMember
We're using the corporate theme but when I try to add a featured image to a page, it doesn't appear on the page. Is the featured image support removed in this theme?
July 17, 2014 at 10:53 am #114672AnitaKeymasterThe featured image function is used for thumbnail purposes. It won't add the featured image into the body of the blog. Check out Brad's tutorial here in how to accomplish this.
Love coffee, chocolate and my Bella!
July 17, 2014 at 12:08 pm #114696gswartzMemberBased on the blog post it sounds like the only thing I need to do to get it working is paste the small wpsites_featured_image_before_content function code into my functions file. I did this but still no featured image is showing up.
July 17, 2014 at 12:20 pm #114701AnitaKeymasterNo, you need to follow all of his instructions - add the full code and then add the styling to it.
Love coffee, chocolate and my Bella!
July 17, 2014 at 12:31 pm #114703gswartzMemberOk, here's my functions file. I've got all 3 functions in there which include the class but still no featured image shows up. Can you tell me specifically what I'm missing?
<?php /** Start the engine */ include_once( get_template_directory() . '/lib/init.php' ); /** Child theme (do not remove) */ define( 'CHILD_THEME_NAME', 'Corporate Theme' ); define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/corporate' ); define( 'CHILD_THEME_VERSION', '2.0' ); $content_width = apply_filters( 'content_width', 620, 450, 930 ); /** Add new image sizes */ add_image_size( 'featured', 500, 240, TRUE ); add_image_size( 'featured-image', 700, 350, TRUE ); add_image_size( 'home-middle', 275, 100, TRUE ); /** Add suport for custom background */ add_custom_background(); /** Add support for custom header */ add_theme_support( 'genesis-custom-header', array( 'width' => 960, 'height' => 130 ) ); /** Change breadcrumb location */ remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' ); add_action( 'genesis_after_header', 'genesis_do_breadcrumbs' ); /** Add support for 3-column footer widgets */ add_theme_support( 'genesis-footer-widgets', 3 ); /** Register widget areas */ genesis_register_sidebar( array( 'id' => 'featured', 'name' => __( 'Featured', 'corporate' ), 'description' => __( 'This is the featured section.', 'corporate' ), ) ); genesis_register_sidebar( array( 'id' => 'home-middle-1', 'name' => __( 'Home Middle #1', 'corporate' ), 'description' => __( 'This is the home middle #1 section.', 'corporate' ), ) ); genesis_register_sidebar( array( 'id' => 'home-middle-2', 'name' => __( 'Home Middle #2', 'corporate' ), 'description' => __( 'This is the home middle #2 section.', 'corporate' ), ) ); genesis_register_sidebar( array( 'id' => 'home-middle-3', 'name' => __( 'Home Middle #3', 'corporate' ), 'description' => __( 'This is the home middle #3 section.', 'corporate' ), ) ); /** * @author Brad Dalton * @example http://wpsites.net/web-design/add-featured-image-before-content-in-any-theme/ * @copyright 2014 WP Sites */ add_filter( 'the_content', 'wpsites_featured_image_before_content' ); function wpsites_featured_image_before_content( $content ) { if ( is_singular('post') && has_post_thumbnail()) { $featuredimage = get_the_post_thumbnail(); $content = $featuredimage . $content; } return $content; } add_filter( 'the_content', 'wpsites_image_before_content' ); function wpsites_image_before_content( $content ) { if ( is_singular('post') && has_post_thumbnail()) { $img = get_the_post_thumbnail($post_id, 'full', array('class' => 'alignright')); $content = $img . $content; } return $content; } add_filter( 'the_content', 'wpsites_linked_image_before_content' ); function wpsites_linked_image_before_content( $content ) { if ( is_singular('post') && has_post_thumbnail($thumbnail->ID)) { echo'<a href="' . get_permalink( $thumbnail->ID ) . '" title="' . esc_attr( $thumbnail->post_title ) . '">'; echo get_the_post_thumbnail($thumbnail->ID, 'full', array('class' => 'alignright')); echo'</a>'; $content = $thumbnail . $content; } return $content; }
July 17, 2014 at 12:51 pm #114707AnitaKeymasterPlease provide a link to your site so we can take a look. Also, did you add the styling snippet in there?
Love coffee, chocolate and my Bella!
July 17, 2014 at 1:17 pm #114713gswartzMemberYes, I added the css to our style.css file. Here's the page that "should" have the featured image showing up. http://royaloakhealth.hiringhook.com/about-us/
July 17, 2014 at 1:28 pm #114714AnitaKeymasterThe only thing I can think of right now looking at his tutorial is that it's for "posts" and not "pages." To confirm that - can you add a featured image to a test blog page and see if it works?
Love coffee, chocolate and my Bella!
July 17, 2014 at 1:36 pm #114720gswartzMemberYes, if I add it to a blog post, it shows up 3 times.... I'm guessing once for each function in the function file?
July 17, 2014 at 1:38 pm #114722AnitaKeymasterSo you should only add one of his snippets then and not all three.
Love coffee, chocolate and my Bella!
July 17, 2014 at 1:40 pm #114723gswartzMemberLooks like changing it from is_singular('post') to is_page() allows it to work on the pages which is really what I needed. Thanks!
July 17, 2014 at 1:43 pm #114725AnitaKeymasterAhhh okay! I am book marking this for my records!
Love coffee, chocolate and my Bella!
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.