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
- Is there a way to enable horizontal margin for a specific block element?
- Customizing a WordPress theme without changing it?
- how to add version of style.css in wordpress
- This CSS Stuffing Works, But Is This A Good Practice?
- 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?
- How to make a theme with more than one CSS file?
- Add a page outside of the current theme?
- How to set two different themes on one WordPress? (Desktop vs. Mobile)
- 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?
- Modify CSS via Theme Control Panel
- How to automatically highlight syntax of code in a post?
- How to add the main style.css to my index.php?
- The style.css stylesheet doesn’t contain a valid theme header
- Copying theme from Localhost to Live does not copy all theme settings with it?
- Getting rid of unused css directives [closed]
- Register theme customizer settings when theme activates [duplicate]
- Switch Theme Through Options Panel
- hfeed CSS class in Twentyeleven Theme
- How to make alert for new version on theme options?
- 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?
- Change logo on each page of University Hub theme [closed]
- How do I copy my Parent Templates to my Child Templates?
- How to go about pre generating css file with variables from theme options
- Is there a reliable way to keep track of how long a WordPress theme has been active?
- Theme information in style.css being corrupted
- How do you create a custom WPTouch theme?
- How to start learning CSS and theme development?
- Does uninstalling a WordPress theme delete its database values?
- Cannot find the code for “Edit This” link in posts in a specific theme
- How do I apply my CSS to a theme page?
- Defining different theme for Blog posts page
- Working with an Array inside Your Theme Options Array – Multiple Values
- How do you get thumbnails to show up in the admin edit post?
- Theme Development Admin Area [closed]
- how to remove padding from left and right side? [closed]
- 404 Error while accessing the font files
- How to set different settings for a mobile theme?
- How to load parent theme style.css?
- Add a series of checkboxes to theme options
- Child Style.css not overriding parent theme style located in assets/css/main.css
- Disable Theme API / Front end (for API only environment)
- What’s the proper way to include inlined javascript-source?
- How to understand a specific bit of WordPress syntax
- How does a Child Theme works?
- 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
- Creating a theme options page
- How can I display/hide certain content based on a Theme Option field?
- none of my css is working in my child theme
- X-Axis of Site is Messed Up Because it is in Hebrew
- Posts and Pages not showing on admin, but showing in theme
- loss of theme options while site deployment in production
- Globally register styles but enqueue them selectively
- Theme settings default, strange behavior before first save
- Style the archives/category sidebar widget via theme
- Selectbox in admin panel function linking to CSS
- How Do I Use A Custom Mobile Theme?
- New custom theme option (text input) giving index error
- How can I make some themes usable only by admins?
- Custom options below pages/posts editor?
- Custom CSS doesn’t work in edit mode
- Remove transparancy in Sydney theme’s headerimage
- How can I add class to every quote element?
- Twenty fifteen theme – change responsive menu condition
- CSS Start Fresh option on; main.css still being loaded [closed]
- Redux callback action
- Port existing Bootstrap site to WordPress?
- How to style the post previews/links without it affecting the main posts?
- Full page (no WP admin menus and options) admin theme options
- Different logo on homepage
- How to display message (with switch_theme hook) after deactivating My theme?
- 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
- Preserve theme settings when migrating from local to live
- Functions containing parameter ‘yourtheme’
- How to dynamically change theme’s slogan from admin?
- What is the “pub” theme? [closed]
- Need to edit themes HTML code
- Plugin and themes are adding the same stylesheets