*

kenoffice

  • **
  • 26 posts
Favicons and child theme
« on: October 08, 2023, 11:34:42 AM »
Hi.
I noticed an issue with favicons when we use child themes.
Right now, the favicons are loaded from main/parent theme; in case of an upgrade of theme the new favicons will overwride the custom ones, and I need to put my own favicons once again in that folder :(
I use child theme in order to have custom modifications, but the problem is on head-favicon.php which don't know to look for icons on child (current) theme, in fact it look on parent. Example:
  $path = osc_base_path() . 'oc-content/themes/epsilon/images/favicons/';
  $url = osc_base_url() . 'oc-content/themes/epsilon/images/favicons/';
Also I have some customizations on functions.php copied into child_theme, which also I guess the bellow function should call the right (child theme) modified functions.php:

  require_once ABS_PATH . 'oc-content/themes/epsilon/functions.php';

Same thing I observed also at Gamma theme.
 
Right now I put an sticky note for myself to take care about this at next upgrade but will be nice if back-end team will take into consideration to adjust the file so for the future to forget about this.
Like instead "epsilon" to have an variable like "$_current_theme".

thank you !
There is no perfect classifieds script. I dream to make it.

*

MB Themes

Re: Favicons and child theme
« Reply #1 on: October 18, 2023, 03:34:27 PM »
If you take care of this in child theme, do you need to do anything after update?
Would be beneficial if you share code changes you've did in child ;)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

kenoffice

  • **
  • 26 posts
Re: Favicons and child theme
« Reply #2 on: October 19, 2023, 02:49:35 AM »
For the moment I didn't put too much efforts on this, only I will replace the favicons after upgrade (in case they will overwrite existing/modified ones).
My point was maybe someone from back-end dev team will analyze and consider to adjust the head-favicon.php in order to look for icons in child theme if there is such theme...

Regarding modifications on child there is not too much to say, I just create 2 functions who will call the css and js from child and hooked them (without that modification the main/parent css and js were loaded); for this I followed an tutorial from your website.

This is the functions.php from child:

function gam_child_custom_css() {
 osc_enqueue_style('style-child', osc_current_web_theme_url('css/style-child.css'));
 osc_enqueue_style('responsive-child', osc_current_web_theme_url('css/responsive-child.css'));
 
 if(eps_is_dark_mode()) {
 osc_enqueue_style('dark-child', osc_current_web_theme_url('css/dark-child.css'));
 }
}
osc_add_hook('header', 'gam_child_custom_css');

function gam_child_custom_global_js() {
 osc_register_script('global', osc_current_web_theme_js_url('global-child.js'), array('jquery'));
}
osc_add_hook('header', 'gam_child_custom_global_js');
There is no perfect classifieds script. I dream to make it.