By default, options are auto-loaded. So all options with autoload: yes
will be fetched very early. Your option will not need an additional query.
Also, database access is often faster and more reliable than file access. The options table is also usually included in database backups, and it can be exported in multiple formats. So stick with options.
What you should do: escape the URL. It might have been compromised, so …
if ( ! empty ( $options['div_background_url'] )
{
$section_background_url = esc_url( $options['div_background_url'] );
echo "<section style="background-image: url($section_background_url);"></section>";
}
You could move the custom styles to one style
element in the head
element.
Related Posts:
- Best practices for a Style/CSS based theme options page?
- How do I create my own admin button and theme settings page?
- Exclude stylesheet from admin
- How to mark an option as selected
- How can I show more than 15 themes at a time in the admin menu?
- How to find out if page_for_posts is showing (in order to style menu item)
- Problems to disable the comments for my statics pages
- How to include stylesheet in custom admin using parent_slug
- how to add version of style.css in wordpress
- How can I version the main CSS file?
- How To Add New Option Types To Option Tree?
- How to use media upload on theme option page?
- Any official way to create an admin theme?
- Moving WordPress.com theme and widget settings to self-hosted site?
- I’m trying to add an image in my CSS
- Multisite: setting theme and options when a new blog is created
- How to use scss in wordpress theme?
- How to add the main style.css to my index.php?
- Getting rid of unused css directives [closed]
- Switch Theme Through Options Panel
- How get Themes list via REST api?
- Activate a new WordPress Theme Only for Admins
- Change Theme from Plugin based on query_vars
- Add transparency to wordpress color picker?
- How do I copy my Parent Templates to my Child Templates?
- How do you create a custom WPTouch theme?
- Defining different theme for Blog posts page
- Working with an Array inside Your Theme Options Array – Multiple Values
- Theme Development Admin Area [closed]
- how to remove padding from left and right side? [closed]
- How to load parent theme style.css?
- How to understand a specific bit of WordPress syntax
- Should a child theme share the same theme options row as the parent, or should it have it’s own options row?
- What’s the order of loading wordpress elements?
- Creating new templates in child themes breaks layout
- loss of theme options while site deployment in production
- Globally register styles but enqueue them selectively
- Theme settings default, strange behavior before first save
- How can I make some themes usable only by admins?
- Custom options below pages/posts editor?
- CSS Start Fresh option on; main.css still being loaded [closed]
- Redux callback action
- How to style the post previews/links without it affecting the main posts?
- Different logo on homepage
- How can we hide the parent’s theme url at the child themes details on a multisite?
- What is the meaning of WordPress’s recommended css classes and where are they applied?
- How to switch theme if the current user is admin?
- Finding and disabling ‘rogue’ stylesheet from header: Source Sans Pro
- Cannot apply custom css to IE in the theme
- Functions containing parameter ‘yourtheme’
- Plugin and themes are adding the same stylesheets
- Child theme’s stylesheet cannot load [closed]
- Theming global variables – initializing in index.php but using in header.pho
- Is it good practice moving the main stylesheets after the plugin styles?
- Understanding the theme details in style.css
- Color Options from Theme Customizer API not returning via get_theme_mod()
- Getting a ‘slide down’ js panel implemented within WP
- Need a theme that let the posted content stretched maximum width [closed]
- What’s the default order used by WordPress to load CSS files?
- The requested theme does not exist. Stylesheet is missing – error after changing style.css name to my-styles.css in wp child theme?
- How to trace and resolve a theme problem such as flickering links in WordPress? [closed]
- How to integrate JSS to WordPress
- How to add some php code in header.php using plugin
- header.php-tweak: How to do that getting Meta-Slider into the header-center?
- Setting a new default template for the creation of a page
- Display Headings on Index page in different font sizes
- Event Organiser breaks the theme [closed]
- Get data from Theme Options and use them into meta options field in custom post type
- List of categories instead of dropdown menu selector in admin options
- Menu items do not “open” when mouse hover over them?
- I made new theme directory, why won’t it show up in admin GUI?
- My blog suddenly can’t find my stylesheet?
- WP Nanoplex 1.0.3 malfunction
- What is the most efficient way of adding additional functionaliy for admin only
- Whitespace between logo and site title in Twenty Twenty-Two
- CSS appears to not work on any WordPress theme
- Switching among theme customizations
- removing side space between para and container on generatepress?
- How Can I Disable WordPress Theme Self-Update?
- Theme CSS missing completely
- WordPress 404 on style.css but not on all pages
- Own Theme custom CSS does not display in editor but works in page
- Custom CSS is overwritten by WordPress?
- CSS in child theme isn’t working properly
- TwentyFourteen Theme : Changing grid layout
- Using two stylesheets for mobile compatibility
- Can i add wordpress editor to my custom theme option? [closed]
- EM in CSS different size on wordpress then elsewhere [closed]
- Random text changing to weird icons in both admin & front end
- How do I block a subdirectory from WordPress theming?
- div having different appearances in different themes
- How to Hide Blog Post Author?
- I can’t install theme: theme install failed
- I don’t have permission to save the theme options I created myself?
- Commenting in CSS (//) equals “none”? [closed]
- theme 2016 – customize css – nothing happens
- How to change the standard width of a page
- How to make a page extend full screen [closed]
- Custom Theme Additonal CSS “” are transformed to “>” and “<”
- How to remove pop up on website (css changes not visible)?