Get AMP Content on Theme
-
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?
<?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.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Get AMP Content on Theme’ is closed to new replies.