get_theme_mod()
has a second parameter where you can set the default value, the value to use if the option is not set.
So, if the default value is "1"
, you can use:
get_theme_mod( 'display_header_image_title', '1' )
Then, if there is not value for display_header_image_title
(no value in database), "1"
is used. So, you could check the exact value:
if( get_theme_mod( 'display_header_image_title', '1' ) === '1' ) {
}
Or just true/false:
if( get_theme_mod( 'display_header_image_title', '1' ) ) {
}
Related Posts:
- WordPress customizer: load controls in a custom div
- Customizer Show/Hide Logo and Site Title
- Get/Set wp.customize.previewer.previewUrl
- Customizer: Multiple CSS styles on same element in Live Preview
- make an array in wordpress cusmization api?
- Default Image not showing up in Customizer for WP_Customize_Cropped_Image_Control
- customizer live preview layout picker
- Go Back to Previous Page
- Pass media upload value to input field
- Remove Customize Background and Header from Appearance admin menu without CSS or JS
- Dynamically change feature image in customiser
- Where exactly do I write define( ‘WP_DEBUG’, true ) in wp-config file
- Integrating PHP into Javascript to display map markers with Google API
- Design view breaking on Pages
- Passing array in add_option()
- Display notification only once
- Using wp_localize_script to store the template url into a variable to use in JS
- Page Reloads Before AJAX Request Finishes
- Colorbox ajax loading of outside HTML content works perfect on localhost but not on server
- Ajax return code 400
- Pass PHP variable to JavaScript without inline JS
- How do I display a user’s previous orders as a select box option on a product?
- Simple Plugin with custom javascript wont work – no console error
- Change the CSS of the Customizer API
- Button not refreshing page
- WP functions in .js
- How to prevent XSS alter custom global javascript object & methods in WordPress
- How to inject variables into public-facing JS using wp_enqueue_script
- Customize Theme comment template to Insert VoteUp and VoteDown buttons
- Ajax random number always the same
- Javascript file is not working on single.php wordpress [closed]
- Customizer: active_callback and sanitize_callback incompatibility?
- How to send Ajax request from my plugin in admin dashboard?
- How to register javascript variables in wp_localize_script?
- Menu jumping when calling it via PHP
- Problem custom control Customizer
- AJAX success response is not working but it’s saving my changes
- Post repeating with infinite scroll
- WordPress Ajax Call inserting data but success response false
- How to optimize the IF condition with many conditions and same output [closed]
- Is the wp_enqueue method efficient?
- admin-ajax Firing Error 400 When Logged In
- Making an AJAX call to refresh a table
- add onchange to select in a wp form
- WordPress Customizer Default Image
- Jquery window.send_to_editor function
- 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?
- Please show me how to use an if/else statement in combination with wp_enqueue
- Post repeated when opening in overlay, how do I solve this? [closed]
- How to change logo by category
- Submitting a form, using Ajax, to run a SQL Select query based on user input from the form
- Run JS Code on userlog out
- Is it possible to isolate and use WordPress functions outside of wordpress
- PHP variables in a post?
- Testing a Form’s Zipcode Field with Regular Expressions to Determine WordPress Page Behaviour
- security concerns if using html data-* attribute for l10n?
- Getting text from custom field from customizer
- Hot to check if new posts have been published since page load and notify online users?
- Time Delay a URL Redirect for Specific Page
- Cascading dropdown select search based on Parent Page & Child Page
- Unable to display multiple parameters from url by javascript through shortcodes
- Why would the child theme load in the Customize preview, but not on the site itself?
- Search bar for wp menu
- Executing php on button press
- Run do_shortcode on php template using JS function
- require get_template_directory() . ‘path/to-my/file.php’ BREAKS customize > themes functionality
- Trying to add some custom text into WordPress Post title via function.php
- I have a lot of JavaScript erorrs after SSL someone can help me?
- How can i show specific Category List?
- Using Javascript On Page – Header and Footer Now Missing
- Store data from JavaScript object to custom table in user account
- Adding extra data to shortcode attributes and pass it to JS with wp_localize_script
- Show the subcategory name based on current product
- Customizer textarea with script tag won’t work in live preview
- Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test
- sessionStorage saves input value in browser but it is not loaded in the form field
- Replacing entire tag with shortcode – JavaScript [duplicate]
- How do I make comment-reply-button with that takes to comment reply form on click
- Allow user to choose header style
- wordpress all post filter by year
- Make customizer panel or section button
- How to load WP_Editor JS files manually (with AJAX)?
- Bootstrap Carousel Indicators Won’t Cycle On Custom WordPress Theme
- Display text of price (minus 20%) on every product page in a sentence.
- Populate an array from the loop, and then read the array into JS
- Where to find the html for WordPress site? [closed]
- Why isn’t my custom Javascript showing up in my custom template?
- Create Customization Controls from Array
- 500 (Internal Server Error) of external php file
- Add title and caption to thumbnail image on mouseover
- Problems with plugin that fetches data from database with ajax
- Dynamic Gallery
- Cannot get custom javascript to execute on page
- wp_head makes my custom page template not work in Customizer?
- How to create and add js and css file when server is not on my PC?
- Object of class WP_Post could not be converted to string while trying to console.log wp_get_nav_menu_items
- Check radio get value to array
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- Set variable in javascript and using in my shortcode
- Facing Problem While Running WordPress Hook For Archive, Categories, Author, Date Pages Only