Yes. You can load the code in the customize_register
action. One example:
<?php
// File: functions.php
add_action( 'customize_register', function( $wp_customize ) {
require_once dirname( __FILE__ ) . '/inc/customize.php';
wpse256532_customize_register( $wp_customize );
} );
And the inc/customize.php
file:
<?php
// File: customize.php
function wpse256532_customize_register( $wp_customize ) {
$wp_customize->add_setting( /* ... */ );
$wp_customize->add_control( /* ... */ );
// ...
}
// ... any additional customizer classes and other includes ...
Related Posts:
- Add inline css to theme
- Remove Custuomize Sections
- Define PHP variable from a seperate API if statement
- Combine two active_callbacks into one on theme customizer
- Issues with title-tag and document_title_parts
- Display random categories on the front page (Finding and Editing Theme Functions)
- Need help setting default setting value for radio button in theme customizer
- How to remove Customize from admin menu bar after WP 4.3
- How to get woocommerce inventory status [closed]
- How to use get_template_directory_uri() to load an image that is in a sub-folder of my theme?
- Is it possible to get a theme customizer setting from wp.customize using jquery?
- Return only top-level navigation items from a menu using wp_get_nav_menu_items
- Organize functions.php
- How to override functions.php in child theme?
- Dynamically change feature image in customiser
- One button to change all settings in theme customizer?
- Change parent theme file function in child themes functions.php
- Design view breaking on Pages
- Displaying Widgets
- Show different Customizer Settings on Page-Tamplates
- Dequeue script in template isn’t working
- Add external js file to footer with id
- Changing itemprop from logo to image on custom logo?
- How to load some jquery code to make validation in the theme customizer?
- How Can I Create a List of Values to Be Iterated Through via WordPress Customization API?
- Overwrite Parent Theme add_image_size in Child Theme
- Show excerpt for only first post in query
- How to add css class to image attached in all the posts?
- How to call custom function from functions.php in site-wide template files?
- Logic to Print/echo a css class only for 1st post and ignore all post after 1st? [closed]
- Is there a way to add a class to non current menu item?
- PHP files included in functions.php don’t seem to work
- How to enable template page only for a post id page
- Add caption functionality to custom WordPress theme
- is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript
- How to Display a Plugin function (content) on frontpage using index.php
- Best practices regarding the creation of custom widgets?
- Output and filter data from a XML url
- admin-ajax.php + load-scripts.php hanging for minutes
- Add Custom Background Properties to Customizer
- enqueue styles for only mobile wp
- Unique sequential reservation code
- Call WordPress function outside of WordPress
- Theme Customizer not loading JS for live preview
- How to customize the_archive_title()? Cannot figure out how to change the value it produces [duplicate]
- Control the srcset much more (not all sizes in it each time)
- Check if the image size is available and if not use ‘full’ image size
- Can we create our own theme’s function.php?
- unnecessary request call for js and css after calling wp_dequeue_script
- get_pages() Returns Only One Item
- laoding bloginfo url in function array?
- Some questions about how proper add 2 CSS file in a WordPress theme?
- 400 Bad Request – JavaScript App calling Custom wp-json endpoint
- Getting the teaser text without overriding global variables
- How to pass variables from one function to another or combine functions
- “options.php” not found
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- What is the correct way to include my new functions and scripts in WordPress?
- wp_nav_menu work in functions.php but not in the theme
- Problem in using Customizer
- contact form in template with jquery,validate and ajax
- Why I can’t load my JavaScripts using an hook inside my functions.php file?
- Getting text from custom field from customizer
- Woocommerce Variable Product Dropdown for Custom Shop Template
- Featured Image and Tags problem
- How to fix Function create_function() is deprecated in / themes
- Exclude specific post from query
- Advanced method to control cache of enqueued style/script
- WordPress wp_dequeue_script remove all other scripts
- require get_template_directory() . ‘path/to-my/file.php’ BREAKS customize > themes functionality
- Can I use ‘Featured Image’ as a hero image and a thumbnail?
- wp_title() return random number
- Why does echo on functions.php not yield result in source code?
- How to offset main query without affecting other queries and backend
- Is it possible to use ‘wp_insert_post’ function within a for loop?
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- How to create a WordPress Customizer Button to Clear a Cache?
- MCAPI.class.php showing some error
- How to retrieve image IDs from shortcode content?
- How to create admin ajax function for my contact form
- Class::$template_dir_path=get_template_directory();
- Rest API User Levels
- wordpress not calling peliegro functions.php?
- Language switcher for subdomains
- How to add next height number in Order Attributes inside the Add new page. [duplicate]
- Load a Child Theme’s style.css just before the closing tag
- Can’t wrap my head around this function – any help would be appreciated
- wp_nav_walker that interacts with widgets to setup mega menu
- Allow tags and attributes in post and pages content
- How to add button to top of theme customizer?
- Add the title of a widget as an ID – for anchor links
- Integrating custom API for post content into Admin interface & Public Website [closed]
- Add custom css to theme
- Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?
- How to get postId from the argument $block when register_block_type()?
- WordPress is adding pagination for all pages not only for blog page, How to remove pagination for all pages except blog/posts page?
- Custom customizer CSS priority
- Custom HTML structure in customizer not rendring in Browser
- Customizer cuistom CSS Priority ordre Issue
- Setcookie not setting cookies anywhere except admin