Add footer.php to WordPress child theme

You have wrong argument for the filter. The first argument of the add_filter is the filter you are hooking up to. In your case it’s the mesmerize_get_footer_copyright. The second argument is the Call back function that would run the filter is called. So change your add_filter to this add_filter(‘mesmerize_get_footer_copyright’, ‘change_copyrightText’, 10,1) ;

Do I only need to import style.css for a child theme?

This question depends entirely on the Theme in question, and how it handles CSS. For a Theme that uses only a single style.css file, obviously, you only need to import style.css. For a Theme that links other stylesheets in the document head (they shouldn’t be doing this; instead, they should be properly enqueueing them), you’ll … Read more

Reuse variable in hook callback

If you want to use a variable from a another context in a function, create a class: class CustomLog { private $debug_msg = “”; public function __construct( $msg ) { $this->debug_msg = $msg; } public function log() { error_log( $this->debug_msg, 0 ); } } add_action( ‘init’, [ new CustomLog( “Hi there!” ), ‘log’ ], 20 … Read more

Redefining function in child themes

I think you misunderstood the codex here. You cannot re-declare the same function, except when, and only when, the parent theme has wrapped a function in that conditional statement if ( ! function_exists( ‘theme_special_nav’ ) ) { function theme_special_nav() { // Do something. } } What this means is, you can copy the theme_special_nav() without … Read more

Child Theme, Functions.php Issues

Actually we deal with a single question per QA, but the basic of them can be clarified in a simple manner, we can proceed in this way: First of all let me create a rudimentary child theme of Fukasawa for you. I made a folder inside themes/ folder, named something. Inside the folder I made … Read more

How to maintain wp_enqueue_style dependencies set in parent theme style enqueuing

I’m sure you missed it but the dependency parameter should be an array and not a string. So your enqueue function should be: function child_enqueue_styles() { wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’, array(‘bootstrap’)); } or: function child_enqueue_styles() { wp_enqueue_style( ‘parent-bootstrap’, get_template_directory_uri().’/css/bootstrap.min.css’); wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’, array(‘parent-bootstrap’)); } Reference: wp_enqueue_style

How do I get a parent theme modification from a child theme?

If you look at how the code works, you should notice that theme mods are saved in the *_options table under theme_mods_{theme_slug} with the theme slug being, as near as I can tell, the directory name containing the theme stylesheet, so: $ptheme = get_template_directory(); $theme_slug = basename($ptheme); $mods = get_option( “theme_mods_$theme_slug”); As a function: function … Read more

Under heavy cache conditions, updating the parent theme don’t reflect changes with child theme enabled

You could use the file modification time (filemtime) to trigger a reload (and recache) of the file. This is how I usually enqueue styles (and scripts): $file=”/css/some-styles.css”; wp_enqueue_style( ‘some-styles’, get_stylesheet_directory_uri().$file, array(‘some-dependency’), filemtime(get_stylesheet_directory().$file) ); This results in something like the following: <link rel=”stylesheet” id=’some-styles-css’ href=”https://wordpress.stackexchange.com/questions/130821/.css/some-styles.css?ver=1388657898″ type=”text/css” media=”all” /> You would have to do this for both … Read more

Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons

Ok, this is what I did: First, I replicated classes/class-twentynineteen-svg-icons.php to the child theme. Renamed to class-mytheme-svg-icons.php. Added a extend with my New_SVG_Icons class: class New_SVG_Icons extends TwentyNineteen_SVG_Icons { /** * Gets the SVG code for a given icon. */ public static function get_svg( $group, $icon, $size ) { if ( ‘ui’ == $group ) … Read more