Read More Button always visible for Sparkling WordPress theme

Dear Support
How can I make the ‘Read More’ button invisible when there is nothing more to read? The button is always displayed which suggest that there is more text. Some of the blog visitors have commented that this is annoying.

I’ve searched your support forum and it seems that other have similar problems. However, non of the suggested solutions could fix my issue.

I use template version 1.6

Kind regards
Stephane

With this you will hide it in every case. Maybe you can figure how to make it conditional. I don’t know.

.btn.btn-default.read-more {
    display: none;
}

Thanks Chaoscontrol, but I don’t want the button to disappear completely. The normal behaviour of a read me button is that it only appears if there is something more to read. So yes, it has to be conditional and I would expect that to be the default.
Stephane

To make read more button to work default way you should get rid of existing button inside content.php file. By removing this line

<p><a class="btn btn-default read-more" href="<?php the_permalink(); ?>"><?php _e( 'Read More', 'sparkling' ); ?></a></p>

Afterwards you should add this code to functions.php file.

add_filter( 'the_content_more_link', 'sparkling_excerpt_more' );
function sparkling_excerpt_more() {
  return '<a class="read-more btn btn-default" href="'. get_permalink( get_the_ID() ) . '">' . __('Read More', 'sparkling') . '</a>';
}

These changes can be done via Child Theme as well.

Hi! I did exactly as you told but the button didnt disappear and it made the whole sentence on the carousel clickable which I dont want.
How can I fix that??

Also, is there a way to make the images on post go all the way to the edges, without the side spaces?

Thank you

Unfortunately this fix doesn’t actually work

Is there a certain space you are supposed to put the code in the functions php

Then try it like this:

add_filter( 'the_content_more_link', 'sparkling_excerpt_more' );
function sparkling_excerpt_more() {
  return '<a class="read-more btn btn-default" href="'. get_permalink( get_the_ID() ) . '">' . __('Read More', 'sparkling') . '</a>';
}

However, you still have to remove existing button like mentioned above.