if anyone faces this in future: thanks to @SallyCJ i was able to solve the issue by adding css style to the customize_preview_init hook.
Here’s the code:
add_action( 'customize_preview_init', function() {
wp_enqueue_script( 'cutomizer-preview', get_template_directory_uri() . '/dist/assets/js/customize-preview.js', array('customize-preview', 'jquery'), time() , true );
if ( !get_theme_mod( '_themename_display_author_info', true ) ) :
add_action( 'wp_head', function() {
echo '<style>#author-info{display:none;}</style>';
} );
endif;
} );
Related Posts:
- Is it possible ( or advisable) to allow open access to the new theme customizer for potential clients?
- Add a dropdown to theme customizer
- WordPress Customizer Typography: How to load just the unique Google Fonts?
- How to remove menus section from WordPress theme customizer
- How to hook CSS file according to theme selection in the customizer section
- How Can I Create a List of Values to Be Iterated Through via WordPress Customization API?
- Change setting name in Customizer and keep the data
- after_setup_theme, Global Variable and Theme Customizer
- get_option in header.php not returning value from customizer
- Internal error 500 accessing Theme > Customize
- Using an if statement in the theme customizer page
- How to disable wordpress from overload my stylesheet styles with customizer styles
- How to enqueue javascript for WP Customize options sidebar?
- Change WordPress header color using customizer
- Alignment Problem [closed]
- WP Customazation API doesn’t save the default Value
- Customize Option Framework
- Related Post Category Filter
- Customizer API Multi Sections in single Panel
- How to customize the colors within a stylesheet using a WordPress setting
- Customizer_register theme options not saving
- Using Customizer value in an external PHP file inside a theme
- “No Data Received” error in Chrome every time i try to update the theme functions file
- trying to figure out how to use more that one image upload in the same section in theme customizer
- How to show associated fields if checkbox is checked in customize widget screen using wp_customize?
- Get entered value of customiser field for live preview
- What are the advantages and disadvantages of Option Tree over the Customization API?
- How to remove the Theme Customization Button from the dashboard and themes options page?
- How To Add New Option Types To Option Tree?
- Trigger Customizer saving process with Javascript only
- Adding customizer styles with wp_add_inline_style
- WordPress settings API error when checkbox unchecked
- Can we add more than one control under a setting in WP theme customizer?
- Widgets panel not displaying in the Theme Customizer
- Is it possible to display the admin bar while in the Theme Customizer?
- How do I get a parent theme modification from a child theme?
- How to Change CSS Variable value in Theme Customizer Live Preview
- Get background color for Live Preview with Theme Customization API?
- WordPress Customizer Control with React
- Modify Javascript Configuration Options for Theme Customizer Colour Picker
- How to change the customizer´s sidebar width?
- Theme Customizer – Choose where widget area appears, to let users organise widgets
- Theme Options page not showing up in admin menu
- How i can get widgets areas working in customizer?
- How to disable automatic colors in the Twenty Twenty theme?
- Input ordering in wordpress theme customizer
- Creating Theme Options Page
- Location of theme options page menu icon
- WordPress add options to theme not displaying
- Create wordpress header with custom logo in between the menu splitting the menu into two equal parts [closed]
- Access theme options in templates
- Single Page Design, Storing in Theme Options
- Edit footer via customizer
- How do i make a custom section’s setting display the default value in Customizer?
- How to add styles set by user in the customizer
- “Add A Widget” button in the Customizer
- How can I make my options in an array and store theme in WP options one DB row?
- How to show custom meta_key in each li of menu
- Can I add multiple arrays within add_theme_support( ‘colors’ )?
- How to: JQuery multiple wordpress media uploader buttons in the same options page?
- Following Web Performance Optimization techniques to output static and dynamic css
- How to modify default controls in WordPress theme customizer
- Is it possible to visually group items on the theme customizer?
- How to support letting users add their OWN logo to a custom theme?
- Customizer – loading settings/controls/sections/panels based on a id/page id
- How can I change the theme of different posts using a plugin?
- How to Create custom xml file for demo content for custom theme?
- Why is an array created in a function hooked to customize register populated when customizer is loaded but not when the front-end is loaded?
- Is there a WordPress boolean for “theme_customizer_active()”?
- WP_editor doesnt apply wpautop on single line content
- Adding a new setting using Kirki or WP customizer with an if statement
- Create something that can be added or removed in Customizer
- add shortcode support in customizer
- How add built-in textarea in theme development?
- How To Display Value from Theme Options Field in Front End Template?
- Update Specific Key Value in Complex `wp_options` object
- Tabbed theme options query about add_settings_section callback function
- Why my theme option not working?
- How to set a custom URL for the iframe in the customize page
- How to dynamically set a background image with the customizer without putting the css as an inline-style
- Image cropping isn’t working correctly when using Offload Media
- WordPress Custom Theme : Theme Builder vs ACF vs Gutenberg
- Styling the website via the customizer – do the changes stay after theme update?
- How to toggle WP Customizer Panel and Section with JavaScript API?
- Debugging slow WordPress Theme Customizer (Any option similar to Query Monitor)?
- I updated my own theme’s code and css
- Theme option page doesn’t save options
- Add multiple sections, settings and controls at once to the Customizer
- How to fix an issue with customizer live preview?
- how to call options on front end and add logo
- Editable screenshot.png in a custom theme developed
- get_theme_mod not pulling css colors into header using wp_head
- Theme customizer live preview JS- Trying to bind to an html image url without luck
- Theme automatically inserting “more” tag on every post
- Custom widgets in theme option page
- wp_deregister_script was called incorrectly
- Undefined index: debuging error for theme option template snippet
- My theme is full of error messages in the “Customize” screen, but nowhere else
- WP Customizer get control value on change
- Execute javscript when theme customizer loads (autosave issue)