简体   繁体   中英

Wordpress ACF field into a stylesheet

So, i've set up a custom post type for theme settings, and a custom field edited from there for background color.

Script reads the style.php styles, unless i'm trying to get the field value.

Here is a piece of code I'm trying to make work

html, body {background-color:<?php the_field('page_background_color');?>;}

When looking at the source, background-color value is just blank.

When you work with the ACF Options Page you must user a string "options" as parameter for the function get_field() and the_field()

Try

html, body {background-color:<?php the_field('page_background_color', 'option' );?>;}

ACF Options Documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM