You can also use it to preload related articles while a user is reading. Or preload pages when a user hovers over a link. Doesn’t have to be 100% headless.
I’m personally toying with a partial headless concept myself – modifying CRA build output into a read-to-install theme. So it’s still in WordPress as a theme, but you have the power that client side rendering gives you. If I can find the time to write a php apollo hydrator then it’ll be perfect.
I am new to wordpress, but I’ve found that I need to use this code! 😀
However, putting the OP’s code in page.php or functions.php within my theme’s folder does nothing. How would one go about using this code?
Right now my page code looks like this:
<?php
if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php echo get_the_content(); ?>
<?php wp_link_pages(array('before' => '', 'after' => '', 'next_or_number' => 'number')); ?>
<?php endwhile; endif; ?>
which works great, except for plugins aren’t working when I add them to a page. Any help would be most appreciated.
-Jon