简体   繁体   中英

How to programmatically get the theme main color in WordPress?

Is there a way that I can grab the active theme main color like get_user_option( 'admin_color' ) . Otherwise what is the best way? I know theme options are stored under wp_options under like theme_mods_twentyfifteen but is there an easier way to grab it?

The get_theme_mod() function would be the most appropriate for what you wanted. This relies on the theme actually saving a main color option of some kind as a theme_mod (they should be, really all theme modifications should be theme_mod s and not regular options).

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