I understand what you are trying to do, but you are going in the wrong direction here, you can just check if one was selected in your logic and assign the value there like this:
function css_customizer(){
$blog_setting_val = get_theme_mod('blog_setting');
$opacity_val = ($blog_setting_val == 'block') ? '1' : '0';
?>
<style type="text/css">
.blog__Link{display: <?php echo $blog_setting_val; ?>}
.second_css_class{opacity: <?php echo $opacity_val; ?>}
</style>
<?php
}
add_action('wp_head', 'css_customizer');
that should do it for your particular case.
Related Posts:
- How to extend nav-menu-item-control data in Appearance > Customize?
- How to change popular term checklist title when edit post?
- Is it possible to add custom badges to product attributes conditionally, based on custom field?
- New WP_Customize API – how does it work under the hood?
- How to Add Customizer Setting in Child Theme
- Custom ReCaptcha Login
- Creating my own Admin Forms in a WordPress CMS?
- How to make custom bulk actions work on the media/upload page?
- Removing fields from the Media Uploader/Gallery
- deleted users still show in count?
- How to add checkbox and radio button in Profile Page
- customize_register with Multiple controls/settings – how to get values?
- Manipulating post meta in the customizer
- Widgets not working in Customizr but working in Appearance
- How to build custom WP admin with custom URLs
- In the new Theme Customizer API, how to send a value from the front back to the admin panel?
- get_theme_mod(); returns nothing
- generate unique number when registering a user
- Redirect members to custom page upon logging in through WP admin
- How to get input_attrs in the sanitize function?
- Allow Users to Set Password During Registration
- Customizer image control default value showing in customizer but not on frontend
- Add a page that appears in the backend admin that lists files to download? WP 3.3
- Adding “Interesting Tags” & “Ignored Tags” like StackOverflow.com in a WordPress Blog?
- Add new Control to Customizer to modify Headings (h1, h2, h3…) Color
- Passing page url into a custom field via the Press-This bookmarklet
- Custom column sorting in WordPress admin post table
- What will happen to the additional CSS when the theme is updated?
- Hide custom field if empty
- Extend Screen Options
- Admin Panel – Custom Menu Sub-Item LINK
- Query posts by category AND custom field, then ORDERBY another custom field – help!
- list/consult Taxonomy only for the respective author/creator in dashbboard
- Add more then one site logo – custom-logo theme support
- Adding custom styles to dropdown in editor
- Fatal error in wp-admin/customize.php after fresh install due to null $wp_customize
- Enabling Additional CSS / custom-css
- Can not sanitize select control in customize api
- how to add custom css and js on wordpress post editor directly without using .php file
- Advanced Custom Fields: Sorting custom columns with custom fields sorts only by date
- How to customize core admin pages within a theme?
- Allow non-admins to access the Customize theme page
- Create custom fields as image uploads [duplicate]
- WordPress customizer Preview not loading
- For a specific theme, how do I build a list of all the possible theme modification names?
- Allow guests to use WP Customizer but disable save button
- What requirements for ACF custom fields key and name properties?
- How do I remove a customiser option from a parent theme in a child theme?
- Extend WordPress Core Classes in OOP Theme?
- How to insert a writing panel between the title and the page content?
- How to add css option to Header Image customizer?
- Customizing Users in Admin Area
- Restrict Viewing of post on both front and backend?
- How to print Array values of custom Fields Meta?
- What is the best way to modify Admin Panel on WordPress?
- add custom content to appearance/widgets screen
- how to make a custom field readonly or disabled by user role?
- How to edit alternate inactive themes in “Appearance -> Customise” screen?
- Remove Customizer Control Choices (Type: Radio Array) using Child Themes
- Let author add field to metabox by pressing a button
- Is it possible to rename a customizer control heading?
- Make separate text boxes for separate WordPress Custom Fields
- Open login logo URL in new tab
- Change admin_title of a plugin using code snippet/functions
- How to get Previous Visited Page Information
- Will WordPress updates remove Gutenberg Additional Classes?
- WordPress category custom title
- Easily add custom HTML outside the main container?
- How can Use custom input field in functions.php page?
- Simple custom attributes on posts
- Use a custom page with dynamic content as a user profile page
- Delete a column in edit.php generated with a plugin
- Add admin page for specific post status (for example)
- Query Product categories what have a custom field
- Can’t Customize WordPress Page
- How to show Term ID beside Name Category with wp_dropdown_categories()
- How to create custom backend admin menu in different languages?
- Adding a drop-down (select tag) option under Menu Settings in WordPress Admin
- POST 429 Error when trying to place more than 20 images into post at once
- WordPress Customizer: Check for value of CSS selector and replace it
- Check get_post value after wp-admin login
- Custom Admin Section
- where can i find the login page in wordpress and add my header to it
- In wordpress customizer api adding div wrap to control
- How do I enable the text editer in my WordPress theme? [closed]
- Style Radio Buttons inside Edit Page (Custom Fields)
- Does WordPress support template resources/custom fields
- Change default “Apply Changes To” radio option when editing images
- Change post template the proper way
- Changing a setting in the wp-admin/customize.php reverts CSS styles to parent theme [closed]
- Extend WP_Customize_Control with Multiple Field Control
- Apply `the_content’ filter to theme customisation live preview
- How to create functions that affect only a specific user
- Do i need to use PHP in customizer api?
- Prevent posts from being published if the ‘Uncategorized’-category or no category is selected
- Save And Display Mp3 Audio files on WooCommerce product page with Dokan
- Advice how to connect custom database with WordPress, change data in WordPress and finaly use this data
- Add custom information in editor summary
- Import bootstrap 5 and bootstrap icons in wp-admin backend
- Hover Hide-Visible Additional CSS not working in WordPress website, but shows properly in Customize window