Open hmaesta opened 6 years ago
amp_content() is the replacement of the_content() – but what is the replacement for get_the_content()?
amp_content()
the_content()
get_the_content()
I lookup on AMP for WP code and found several references to get_amp_content(), but that function does not work when applied on a theme.
get_amp_content()
On WordPress I use a function to insert specific code after third paragraph. It's very simple and I need the same on AMP. How can I do it?
<?php $paragraphAfter = 3; // display after the X paragraph $content = apply_filters('the_content', get_the_content()); $content = explode("</p>", $content); for ($i = 0; $i < count($content); $i++) { if ($i == $paragraphAfter) { echo "<div>Sign up and receive our newsletter!</div>"; } echo $content[$i] . "</p>"; } ?>
I can't use amp_content() since it prints data on screen, not just gets it.
amp_content()
is the replacement ofthe_content()
– but what is the replacement forget_the_content()
?I lookup on AMP for WP code and found several references to
get_amp_content()
, but that function does not work when applied on a theme.On WordPress I use a function to insert specific code after third paragraph. It's very simple and I need the same on AMP. How can I do it?
I can't use
amp_content()
since it prints data on screen, not just gets it.