Sticky post showing full content

I would like my sticky post to show the full content instead of the excerpt, unlike the rest of posts.

I have the code needed, but I don’t know where I need to use it.

<?php if ( is_sticky() )
			the_content();
		else;
			the_excerpt();
		?>

I know it’s around the content.php file, but trying some places it creates weird behaviours.

Hi @Chaoscontrol,

Thanks for posting on the forum.

First of all your code contains an error that “else” part should not be closed with semicolon instead it should be as following.

<?php if ( is_sticky() )
			the_content();
		else
			the_excerpt();
		?>

Also to avoid problems caused by spaces try to use curly braces like following.

<?php if ( is_sticky() ) {
			the_content();
		} else {
			the_excerpt();
}	?>

Could you please tell me where you want sticky post to show the full content instead of the excerpt? On all post listings pages?

Kind Regards,
Vinod Dalvi

Ok, sorry. I’ll use that correction of yours.
Right now on the home page, my posts just show the excerpt. I would like that my sticky post show the full content instead the excerpt, like an exception to the main rule.
This is my blog, and the sticky post is the first one.

Adding to this topic, I would like to add a color background to the sticky posts, so they are seen different.
I tried this:

.sticky {background: #dadada; padding: 10px;}

But what it does is showing the color background around the post itself. If I remove the padding nothing is showed. So I guess it’s something about the theme, cause everyone formats it this way. How can I do it?
I want it only on homepage!

Hi @Chaoscontrol,

Thank you for your reply.

By default the sparkling theme that you are using displays full post content on the post listing home page, i think you have changed this by using the solution posted in the following reply.

https://colorlibsupport.com/t/read-more-is-not-working/#post-11403

If this is the case then you can display full sticky post content on the post listing home page by changing that code as following.

<?php if( is_home() && !is_sticky() ){ the_excerpt(); }else{ the_content(); } ?>

To change the background color of sticky posts on post listing page so that they will display differently try adding the following CSS code in the Custom CSS Theme options displayed on the below path in your admin area.

Admin Area -> Appearance -> Theme Options -> Other Tab -> Custom CSS

body.blog .type-post.sticky .post-inner-content {
   background-color: #dadada;
}

Best Regards,
Vinod Dalvi

It worked wonderful. Thank you a lot.

Just a quick adding to it. As the sticky post now shows its full content, I would like to to hide the Read more button, just for that case. It have disabled comments, and the author is not important, so it has no sense to make users go in.

I’ve been reading 2 topics about it:

https://colorlibsupport.com/t/remove-read-more/
https://colorlibsupport.com/t/read-more-when-theres-nothing-to-read/

It seems it must be done by post id, but I don’t really know how to do it.

Solved!
I used this:

/* Hide Read more button from sticky posts */
body.blog .type-post.sticky .btn.btn-default.read-more {
    display: none;
}

Hi Vinod or other mods/helpers. Replying here instead of making a new thread because I have some of the same questions.

  1. I tried to change the color of my sticky post but I think it’s not working right in travelify 3.0:

and 2) how can I change the color of the (green) shadow on my sticky post?

Thanks!