To dinamically change the stylesheet and template URI you can use stylesheet_uri
filter and template_directory_uri
filter.
For example:
add_filter( 'stylesheet_uri', function( $stylesheet_uri ) {
$stylesheet_uri = 'your new stylesheet URI here';
return $stylesheet_uri;
} );
But, as you are using W3TC, you can configure that change in the plugin itself (Generic Mirror and Self-hosted CDN options), even you can configure pushing files automatically if the CDN service support it.
Related Posts:
- What is the problem if I use CDN in my WordPress parent theme(built using bootstrap)?
- What is the preferred way to add custom javascript files to the site?
- Should I use set_transient or update_option?
- Custom Taxonomy Tree view
- Best practice way to implement custom sections into a WordPress theme
- Add a preview to a WordPress Control Panel
- Change text of twentyseventeen_edit_link()
- How do I get my child-theme to work with my theme’s includes folder?
- wp_insert_post breaks rewrite rules
- Where can I find a good reviewed collection of Twenty Ten child themes?
- How do I remove RSS feeds from themes?
- Template Hierarchy for get_header()
- How to add (css) classes to only one wp_nav_menu()?
- Advantages of using instead of wp_enqueue_style()?
- Style.css redirects to 404 Page not found
- How to add suggest plugin to theme?
- When developing a distributable Theme, does it HAVE to be “inheritable”?
- how do I get a sidebar’s id or number for use with is_active_sidebar()
- Looking for the code in twentyten that allows users to select images for the header/banner
- Relative Time On Posts
- Prevent update check for specific theme
- using wordpress without javascript
- Theme Check: Could not find post_class
- Unhook jQuery from WooCommerce via `functions.php`? [closed]
- Free starter theme to make mobile websites? [closed]
- Set a static front-page as a landing page programmatically
- WP 3.1 upgrade breaks AutoFocus+ theme
- Comment entry screen shows even though “Allow Comments” is unchecked
- How can I display/hide certain content based on a Theme Option field?
- Custom WordPress Theme – Search not working on posts
- How can I make that when I clic on one of the menu items, that page shows only posts with the same category?
- Hide header texts (Title & Tagline) in custom-header.php
- Why an arugment is missing in wp_get_attachment_image_attributes?
- Archive page doesn’t work
- Where to hook settings api init
- How to add “Template” option in page attributes panel?
- defining a folder location in order to recall it
- How can I detect hierarchal relationships beyond children (grandchild, great-grandchild, etc)?
- How to enable thumbnails in RSS dashboard widget
- How to check if a WordPress core block is active in sidebar
- How can i attach the attachment-ID to the user profile image?
- JavaScript stops working on selectively refreshed sections one inside the other
- How can I fetch the WordPress cart errors normally displayed in woocommerce-error?
- wp_remote_get times out on api request but jquery GET and postman work?
- Folder name for a pro version of a WordPress.org theme?
- Remove settings if theme is deleted?
- Using WordPress’ Theme Customizer to select page templates that update layout in the preview
- Custom Blocks as part of a theme
- How to set up diffrent mobile theme for single site in WordPress?
- what is the difference between uri and path?
- Derive child theme from separate theme
- How to change footer or for different kinds of users in wordpress?
- How to Download Minimum Requirement of WordPress (Not Themes )
- Create a child theme from multiple themes
- How can I use the WordPress Loop and Pagination in multiple instances but different scenarios throughout my site?
- How to determine (via php) if site is using a static home page?
- Migrating to WordPress – but how will it do “structured” data?
- How to fix : Uncaught ArgumentCountError: Too few arguments to function? [closed]
- I have WordPress setup on primary domain, how do I set it up on its subdomain using the same database?
- Theme development – Automatically menu creation
- What is the best way to build home pages with a lot of sections for distributable themes [closed]
- How to generate a hierarchical list of all pages and child-pages using a regular query?
- Should is_active_sidebar() always be used around dynamic_sidebar()?
- pre_get_comments or the_content filter
- using part of a theme in another theme
- WordPress pulling in random page themes
- Trouble in enquing all js files under certain directory
- Pagination: Keep prev and next link even on the first/ last page
- How to remove permalinks links presents in each page of my site?
- Stop WordPress from showing images on non post pages
- Is there a way to serve different resolution images to different devices?
- How to substitute old wordpress menu by wp 3 menu the right way?
- Why my theme option not working?
- How to use multiple check-box values to work in a function and insert values in database
- Catch the moment when theme is deleted
- Attribute form NumberControl doesn’t update when I update page before it lose its focus
- Next and previous post link shows error in first and last post
- create loop for the_content()
- how to change footer content for certain pages only
- Should I use template files or just use conditional tags in index.php?
- Media & Plugin screens stall
- wp_kses allow checkbox class and checked
- Is wp_mail plugin territory?
- HTML TO WP Theme : Submenu goes down wp_nav_menu
- How do I remove p tag *insertions*? Disabling `wpautop` removes manual tags
- Create a variable with string, array or multiple values
- How can I include the js and css file of my custom theme dynamically in header.php
- WordPress Blog Page displaying nothing
- Full width thumbnail
- What hook to use for loading a custom class extension during Theme initialization?
- Set start page depending on screen width [closed]
- How can I change the title of the Home link in the navigation bar?
- Use external fonts in WordPress stylesheet
- Custom link color or stylesheets
- What is the advantage of using home.php over index.php for the front page
- Add option for administrator to submit link
- Display recent posts on front page
- How to make a multilingual wordpress site to be translated one-to-one without much effort and without using translate?
- Theme template file for a specific custom taxonomy
- How do I work with responsive images in WordPress? (img srcset/sizes)