I am using an :after pseudo selector to place some text after an element on my page. I would like for this text to be content managed using Advanced Custom Fields, but I am not able to get it to work. Here is my code:

<style>
    .hc-copy:after {
        content:"<?php the_field('hero_paragraph'); ?>";
        display:block;
    }
</style>

When the PHP is parsed, the content property is just empty on the page. Is this possible?

2 Answers
2

To make sure your fields are populated use the following code to print all the values that are set:

<?php
var_dump( get_fields() );
?>

The ‘hero_paragraph’ key should be present somewhere in the printed values.

Leave a Reply

Your email address will not be published. Required fields are marked *