SPARKLING 2.2.2 UPDATE

after updating sparkling to 2.2.2 from 2.2.1 Read more Buton on Home Page posts Not Visible. Please Help

The same thing has happened to me.

I edited line 42 of content.php by changing ‘the_content()’ to ‘the_excerpt()’

Thanks in advance.

Hello,

I had the same problem, but i fixed it by editing both ‘the_excerpt()’ in content.php to ‘the_content()’.
English is not my native language, so i hope that you get the point.

BTW make sure that the box that says “Show post excerpts?” is checked.
You can find it by going to the customizer, then sparkling options and then content options.

This solved the problem for me!

Musclesandfood.nl

Thanks,

I did what you said and changed ‘the_excerpt()’ (X2) to the_content() but it didn’t work.

Made sure “Show post excerpts” was ticked, but no change.

If you send me a picture of your content.php script i can take a look at it and try to fix it.

Btw… you said you changed ‘the_content()’ to ‘the_excerpt()’ in line 42. YOU SHOULD LET THAT JUST BE ‘the_content()’

So you must have ‘the_content()’ 3times in your content.php script

Okay, thanks,

I just tried that placing ‘the_content()’ three times in the script, but there was no change.

Here is a .txt file of the content.php script.

Thanks for offering to take a look

i’ve checked your script, and everything seems to be alright. Have you made any changes to other scripts? And a stupid question, but you do use the read-more-tag, right? xD

Okay, I’ve fixed it.

The problem was something I didn’t expect. After editing the .php script, I looked at the “Show post excerpts” check-box and it was already turned on… So I didn’t do anything.

Then I had one of those “what if” moments and turned off the “Show post excerpts” check-box to see what would happen. When I turned it back on, the “Read more” button was in place.

For me, only line 42 needed to be changed to ‘the_content()’. The other two lines remain as ‘the_excerpt()’.

Thanks for the help musclesandfood. I appreciate it.

See my final comment.

You might need to turn off the “Show post excerpts” check-box, then turn it back on again.

I want to use native ‘Read more’ functionality, so I replaced this

<?php
if ( get_theme_mod( 'sparkling_excerpts' ) == 1 ) :
	the_excerpt();?>
	<p>[...]</p>
<?php else :
	the_content();
endif;
?>

to this

<?php
if ( get_theme_mod( 'sparkling_excerpts' ) == 1 ) :
	the_content('Read more...');?>
<?php else :
	the_content();
endif;
?>

but nothing happens, there’s no ‘Read more’ link, just the content before <!–more–> (if there is).

What’s the problem?

I want to display content form posts before <!–more–>, not the excerpt, and show the ‘Read more’ link.

Thx for your help!

If You Click Customize Button in admin bar Readmore Button Appeared But After Closing the Customizer Menu It Disappeared Again I Think it is the Problom In the updated code

Here is my workaround for my problem.

I added a new function (based on get_the_content() core function) in functions.php:

if ( ! function_exists( 'sparkling_has_more_tag' ) ) :
function sparkling_has_more_tag() {
	global $page, $pages;

	$post = get_post();

	$has_teaser = false;

	if ( $page > count( $pages ) ) // if the requested page doesn't exist
		$page = count( $pages ); // give them the highest numbered page that DOES exist

	$content = $pages[$page - 1];

	if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) {
		$has_teaser = true;
	}

	return $has_teaser;
}
endif;

And changed this in theme’s content.php:

<?php
if ( get_theme_mod( 'sparkling_excerpts' ) == 1 ) :
	the_excerpt();?>
	<p>[...]</p>
<?php else :
	the_content();
endif;
?>

to

<?php the_content(); ?>
<?php if ( sparkling_has_more_tag() ) : ?>
	<p>[...]</p>
<?php endif; ?>

So, if post has <!–more–> tag, Sparkling styled “Read more” button shows.

A little note. The line $post = get_post();, and $matches variable not needed in sparkling_has_more_tag() function.