theme cache
engAhmad opened this issue · 2 comments
for every change i have to clear the browser cache also using cache plugin so many times , tried to change the configuration in the function.php but with no luck , this behavior slowing down the development process
`<?php
/**
- Understrap Child Theme functions and definitions
- @Package UnderstrapChild
*/
// Exit if accessed directly.
defined('ABSPATH') || exit;
/**
-
Removes the parent themes stylesheet and scripts from inc/enqueue.php
*/
function understrap_remove_scripts()
{
wp_dequeue_style('understrap-styles');
wp_deregister_style('understrap-styles');wp_dequeue_script('understrap-scripts');
wp_deregister_script('understrap-scripts');
}
add_action('wp_enqueue_scripts', 'understrap_remove_scripts', 20);
/**
-
Enqueue our stylesheet and javascript file
*/
function theme_enqueue_styles()
{
// Get the theme data.
$the_theme = wp_get_theme();
$theme_version = $the_theme->get('Version');$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
// Grab styles urls.
$theme_styles = "/css/child-theme{$suffix}.css";
$css_version = $theme_version . @filemtime(get_template_directory() . $theme_styles);// Grab scripts urls.
$theme_scripts = "/js/child-theme{$suffix}.js";
$scripts_version = $theme_version . @filemtime(get_template_directory() . $theme_scripts);wp_enqueue_style('child-understrap-styles', get_stylesheet_directory_uri() . $theme_styles, array(), $css_version);
wp_enqueue_script('jquery');wp_enqueue_script('child-understrap-scripts', get_stylesheet_directory_uri() . $theme_scripts, array(), $scripts_version, true);
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
add_action('wp_enqueue_scripts', 'theme_enqueue_styles');
/**
- Load the child theme's text domain
*/
function add_child_theme_textdomain()
{
load_child_theme_textdomain('understrap-child', get_stylesheet_directory() . '/languages');
}
add_action('after_setup_theme', 'add_child_theme_textdomain');
/**
- Overrides the theme_mod to default to Bootstrap 5
- This function uses the
theme_mod_{$name}
hook and - can be duplicated to override other theme settings.
- @param string $current_mod The current value of the theme_mod.
- @return string
*/
function understrap_default_bootstrap_version($current_mod)
{
return 'bootstrap5';
}
add_filter('theme_mod_understrap_bootstrap_version', 'understrap_default_bootstrap_version', 20);
/**
- Loads javascript for showing customizer warning dialog.
*/
function understrap_child_customize_controls_js()
{
wp_enqueue_script(
'understrap_child_customizer',
get_stylesheet_directory_uri() . '/js/customizer-controls.js',
array('customize-preview'),
'20130508',
true
);
}
add_action('customize_controls_enqueue_scripts', 'understrap_child_customize_controls_js');
`
Have you tried, instead, to work with dev tools opened after setting "Disable cache (while DevTools is open)" in the Dev Tools Preferences? This way if you refresh a page that have the DevTools tab opened the browser cache (only for that tab) will not be used.
DevTools > Preferences gear icon (top right before the kebab menu) > Network > Disable cache (while DevTools is open)
That's a must have for me while working locally and fine tuning things.
@ironicmoka thank you for your response , it works , also i noticed after changing the version value in the style.css file "the doc block" every thing works using firefox browser ,