Support

Account

Home Forums Backend Issues (wp-admin) Enqueue different stylesheets based off an option Reply To: Enqueue different stylesheets based off an option

  • 
    function custom_scripts() {
        $theme = get_field('global_theme', 'option');
        $stylesheet = ($theme == 'alt' ? '/styles/style.css' : '/styles/style-alt.css');
        wp_enqueue_style( 'custom-style', get_template_directory_uri() . $theme );
    }
    add_action( 'wp_enqueue_scripts', 'custom_scripts' );