How To Include Feature Image Inside Post?
Topics related to Realistic theme goes here.

TahMiD Borhan

Member Rank
Posts: 41
Joined: Mon Dec 11, 2017 12:37 pm
Display Name: TahMiD Borhan

How To Include Feature Image Inside Post?

linkPost by TahMiD » Mon Dec 11, 2017 3:41 pm

I need to include feature Image in to the post, not only thumbnail. Plz me!
User avatar
Asmi Khalil

Site Admin Rank
Posts: 781
Joined: Fri Jun 26, 2015 7:13 am
Display Name: Asmi Khalil
Location: Tunisia

Re: How To Include Feature Image Inside Post?

linkPost by admin » Wed Dec 13, 2017 11:28 pm

Hi again,
To show your featured image on individual posts, just add the below code right before <header class="entry-header"> opening tag if you want the image to be placed before the post breadcrumbs or right before <div class="entry-content"> if you want it to be placed below the title and above the content (in /template-parts/content-single.php file):
<div class="single-post-featured">
	<?php if ( has_post_thumbnail() ) { ?>
		<?php the_post_thumbnail( 'full' ); ?>
	<?php } ?>
</div>
If you want to add some spacing or a border, we can use the single-post-featured class.
I think there is a world market for maybe five computers. - IBM chairman Thomas Watson, 1943
TahMiD Borhan

Member Rank
Posts: 41
Joined: Mon Dec 11, 2017 12:37 pm
Display Name: TahMiD Borhan

Re: How To Include Feature Image Inside Post?

linkPost by TahMiD » Thu Dec 14, 2017 2:20 am

Thank You so much for your awesome support. In future, I will love to purchase pro version of this theme, if available, cuz It's simply brilliant. And one more thing that I really wanna do, currently I am using the alternative layout of this theme, but for only feature post, I wanna keep default layout style big thumbnail, is that possible?
TahMiD Borhan

Member Rank
Posts: 41
Joined: Mon Dec 11, 2017 12:37 pm
Display Name: TahMiD Borhan

Re: How To Include Feature Image Inside Post?

linkPost by TahMiD » Thu Dec 14, 2017 2:59 pm

TahMiD wrote:Thank You so much for your awesome support. In future, I will love to purchase pro version of this theme, if available, cuz It's simply brilliant. And one more thing that I really wanna do, currently I am using the alternative layout of this theme, but for only feature post, I wanna keep default layout style big thumbnail, is that possible?
Plz Ans Me Bro
User avatar
Asmi Khalil

Site Admin Rank
Posts: 781
Joined: Fri Jun 26, 2015 7:13 am
Display Name: Asmi Khalil
Location: Tunisia

Re: How To Include Feature Image Inside Post?

linkPost by admin » Thu Dec 14, 2017 7:10 pm

There will be a premium Material Design theme. Development will be started after the release of Elif theme. The theme will be similar to Realistic but with tons of features and options.
Regarding your question about the layout, I really need a bit more of explanation. The theme currently support 2 different layouts and you can simply switch between them from the Customizer. The selected blog/archive layout will be applied to all archive pages including blog, categories, tags, months archive, search page..etc Do you want to have a different layout for different archive pages? Do you mean by "feature post" sticky posts?
I think there is a world market for maybe five computers. - IBM chairman Thomas Watson, 1943
TahMiD Borhan

Member Rank
Posts: 41
Joined: Mon Dec 11, 2017 12:37 pm
Display Name: TahMiD Borhan

Re: How To Include Feature Image Inside Post?

linkPost by TahMiD » Fri Dec 15, 2017 2:44 pm

Here Is The Photoshop Version of What I wanna DO. Is That Possible?
realistic-th.jpg
realistic-th.jpg (84.85 KiB) Viewed 1937 times
User avatar
Asmi Khalil

Site Admin Rank
Posts: 781
Joined: Fri Jun 26, 2015 7:13 am
Display Name: Asmi Khalil
Location: Tunisia

Re: How To Include Feature Image Inside Post?

linkPost by admin » Fri Dec 15, 2017 7:47 pm

Ah! Now i understand
Well, since version 1.3.0, this has become a piece of cake since both template layouts were separated in two files content-default.php and content-style1.php; content-default.php will render the post with big thumbnail and content-style1php will render the posts with square small thumbnail placed to the left (please ignore the comments at the top, the are a bit misleading).

So, what we need to do here, is to force rendering the default layout (post with the big thumbnail) when the post in the loop is sticky, else, we render whatever layout is selected from the Customizer.
So, open /template-parts/content.php file and change this code:
get_template_part( 'template-parts/content', $style );
To:
if ( is_sticky() ) {
	get_template_part( 'template-parts/content', 'default' );
} else {
	get_template_part( 'template-parts/content', $style );
}
This will work just fine, but you will get a pixelated and stretched thumbnail in your sticky posts instead of the large thumbnail. To fix this, you need to edit /template-parts/content-featured.php as follow:
Change this line (line28):
<?php if ( 'default' == esc_attr( get_theme_mod( 'realistic_display', REALISTIC_DISPLAY ) ) ) {
To this line:
<?php if ( is_sticky() || 'default' == esc_attr( get_theme_mod( 'realistic_display', REALISTIC_DISPLAY ) ) ) {
We have just added a conditional check to check for sticky posts. So if the post in the loop is sticky OR the default post layout is selected, the theme will display the big thumbnail, else, the small thumbnail will be displayed instead.
Hope you find this helpful :D
I think there is a world market for maybe five computers. - IBM chairman Thomas Watson, 1943
TahMiD Borhan

Member Rank
Posts: 41
Joined: Mon Dec 11, 2017 12:37 pm
Display Name: TahMiD Borhan

Re: How To Include Feature Image Inside Post?

linkPost by TahMiD » Fri Dec 15, 2017 9:09 pm

Thanks, :D It's Working. And Yes, You're the BOSS!
User avatar
Asmi Khalil

Site Admin Rank
Posts: 781
Joined: Fri Jun 26, 2015 7:13 am
Display Name: Asmi Khalil
Location: Tunisia

Re: How To Include Feature Image Inside Post?

linkPost by admin » Sun Dec 17, 2017 9:26 pm

Most welcome!
Not sure about the BOSS part tho :lol:
I think there is a world market for maybe five computers. - IBM chairman Thomas Watson, 1943

Who is online

Users browsing this forum: No registered users and 1 guest

It is currently Sun Aug 25, 2019 5:16 am