Archived topic
Read option values in functions.php
1 reply · Started by Marco on January 29, 2019
Viewing posts 1–2 of 2
Hello
I like to be able to check in a custom function whether the "Display featured images" has been checked for e.g. "Archives" in the customizer - does anybody know how to do this?
thank you in advance for your help;
Hi there,
You could do this:
if ( ! function_exists( 'generate_blog_get_defaults' ) ) {
return;
}
$settings = wp_parse_args(
get_option( 'generate_blog_settings', array() ),
generate_blog_get_defaults()
);
if ( $settings['post_image'] ) {
// Archives
}
if ( $settings['single_post_image'] ) {
// Single posts
}
if ( $settings['page_post_image'] ) {
// Pages
}
Of course, the above would need to run inside a function.
Hope this helps! :)
This archived topic is closed to new replies.