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?
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
Reset to default 1To 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.
If that piece of css is in any php file then it should work as you expect. so double check your ACF Field and make sure the field name is correct and some value is set.