InfoPhilicGenesisHow to Display Featured Image Before or After Entry Title in Genesis

How to Display Featured Image Before or After Entry Title in Genesis

Learn how to add featured images to a single post or a page in Genesis child themes. You can set it to display featured image, before or after your title on single posts.

Images are very important for enhancing the appearance of your posts. Adding images in the post benefits you in various ways including increasing the unique visitors.

WordPress CMS has a popular feature named Featured images also known as post thumbnails. The featured image (Post Thumbnail) is pulled from the featured image paying little respect to how you include it in your Edit Post screen.

The image showed earlier or after your single post passage title is pulled from the first image you embed into the post unless you evacuate it.

You can evacuate or alter the code which shows an image earlier or after your single post section titles utilizing one of the code snippets on this page. In the event that you add a picture as a featured image, it will be shown as a post thumbnail and not as a featured image after your single post’s title.

If you don’t include a highlighted picture, the first picture in your post will be shown earlier or after your single post entry titles and additionally on your chronicle pages.

In this post, I’ll give you lines of PHP code you can basically paste at the end of your theme’s functions.php file.

Using the code, you can display featured image, before or after your title on single posts.

Displaying featured image after the title in Genesis:

To display featured image after the title, paste the following code:

<?php

//* Do NOT include the opening php tag

function featured_post_image() {
	
	if ( ! is_singular( 'post' ) ) return;
	the_post_thumbnail('post-image');
}

// Display featured image below title on the single post in Genesis 

add_action( 'genesis_entry_content', 'featured_post_image', 8 );

Displaying featured image before the title:

If you want to show the featured image before the title, you have to use this code:

<?php

//* Do NOT include the opening php tag

function featured_post_image() {
	
	if ( ! is_singular( 'post' ) ) return;
	the_post_thumbnail('post-image');
}

// Display featured image before title on the single post in Genesis 

add_action( 'genesis_entry_header', 'featured_post_image', 8 );

Using the code above, you can show the image before your single post title.

Add Featured Image on Static Pages only:

There are various reasons why people desire to have a static page on their website. If you also want to show the featured image on a static single page, use the following code:

Featured Image

Before the title:

<?php

//* Do NOT include the opening php tag

function featured_post_image() {
	if ( ! is_singular( 'page' ) ) return;
	the_post_thumbnail('post-image');
}

// Display featured image before title on the single page in Genesis 

add_action( 'genesis_entry_header', 'featured_post_image', 8 );

Featured Image After title:

<?php

//* Do NOT include the opening php tag

function featured_post_image() {
	if ( ! is_singular( 'page' ) ) return;
	the_post_thumbnail('post-image');
}

// Display featured image after title on the static pages in Genesis themes

add_action( 'genesis_entry_content', 'featured_post_image', 8 );

Add Featured Image on both Static Pages & Single Posts:

If you wanna show the featured image on both then you can use following code:

Featured Image Before Title:

<?php

//* Do NOT include the opening php tag

function featured_post_image() {
	if ( ! is_singular( ) ) return;
	the_post_thumbnail('post-image');
}

// Display featured image before title on both static pages and single posts in Genesis themes

add_action( 'genesis_entry_header', 'featured_post_image', 8 );

Featured Image After Title:

<?php
//* Do NOT include the opening php tag

function featured_post_image() {
	
	if ( ! is_singular( ) ) return;
	the_post_thumbnail('post-image');
}

// Display featured image below title on both static pages and single posts in Genesis themes
add_action( 'genesis_entry_content', 'featured_post_image', 8 );

Hence, you all set by displaying the images by positioning them. All the above codes are tested and outperformed very well. If you have any queries, feel free to ask in the comment section below.

The latest version of the Genesis framework gives you the inbuilt option to display featured images on a single post and page.

See also

You'll also like:
Continue to the category
Amit Malewar
Amit Malewarhttps://www.infophilic.com/
Amit Malewar has been the tutorial writer since 2013. His passion for helping people in all aspects of technology flow through the expert coverage he provides. In addition to writing for InfoPhilic, Amit loves to read and try new things.

Comment Policy: Your words are your own, so be nice and helpful if you can. Please, only use your real name and limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

GET STARTED
POPULAR NOW

How to Calibrate battery on your android device

For smartphone users, battery problems are the biggest concern. So to overcome this problem I am writing this short tutorial to calibrate battery. Battery issue...
DEALS

WP Coupons

The #1 WordPress coupon plugin for affiliate marketers to increase your CTR and conversions!
spot_img