functions.php
-
Hi again.
I use TwentySeventeen + Advanced TwentySeventeen Child Theme.
As standard, the effective functions.php where to make any tweak should be the one of the Child theme, but what I never understood is that the one where the tweaks work is in TwentySeventeen main theme folder, while the functions.php of the Child theme is empty and apparently dormant.
Is it correct? Thank you.
-
Hi @mrosfy A child theme is a sub-theme that works alongside the parent theme. The child theme relies on the parent theme to control its functionality, however, any modifications that you make to the child theme will take precedence over the behavior in the parent theme.
I am not sure what you are asking exactly, if the above didn’t help clear things up for you might I ask what you mean by while the functions.php of the Child theme is empty and apparently dormant.
- This reply was modified 1 year, 8 months ago by thelmachido a11n.
Hi @thelmachido and thank you for your reply. Yes, correct, that’s the normal procedure of a Child. But in the functions.php of this Child Theme there is only the standard instruction ”
if (! defined('ABSPATH')) {exit;}
” (the one to prevent public user access via URL) and nothing else.It is empty, and the filters I apply there seem not working (so joking I call it “dormant”), and they’re years that I’m adding all my tweaks to the functions.php of parent (TwentySeventeen), and they work well.
Is it normal? (zero statements, scripts, filters? nothing at all ..)
- This reply was modified 1 year, 8 months ago by Mauro Vicariotto.
Advanced TwentySeventeen Child Theme
It sounds like rather than creating your own child theme, you’re using one that was created by someone else, is that right? In this case, the child theme could be constructed differently and perhaps have a different place to add functions. Could you provide a link to where you obtained this child theme? (I couldn’t find it in the www.remarpro.com theme repository.)
As a test, if you create a child theme yourself are you still having trouble adding your custom functions? If so, could you paste an example of a a function that doesn’t work in your child theme here in a code block so folks can take a look directly?
Hi again Kathryn. No, as we spoke few days ago I had such child theme installed in 2017 in one site and in 2019 in another, remember? It is Advanced TwentySeventeen Child, the one which I intend to remove when I will have time to collect all my codes and make a new child (as per your good suggestion).
For now I have this one, even if I dislike (remember?) I told you that I’m using just 3 or 4 small pieces of that, rest customized by me.
I also can’t find in the repository: it was one of the official childs at that time. Now I found it in the web:
It is not a good child, practically it does nothing, and its functions.php is empty. In recent years I have done all my additions to php of parent theme, header and functions.
Just for example, one of the pieces which I added in functions.php of parent theme is
//190325 Mauro: header widget addition (for languages switcher) register_sidebar( array( 'name' => __( 'Header Widget', 'twentyseventeen' ), 'id' => 'header-widget', 'description' => __( 'Add widgets here to appear in header area.', 'twentyseventeen' ), 'before_widget' => '<div class="h-widget">', 'after_widget' => '</div>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) );
or some function to block WP updates, etc etc
Now I was preparing a script to dequeue some codes.
All works, but only if I add in header.php and functions.php of the parent theme .. nothing happens when you use the ones of child theme
The functions I’m adding now:
// Styles function deq_styles() { wp_dequeue_style( 'xxx' ); } add_action( 'wp_print_styles', 'deq_styles', 100 ); // Scripts function deq_scripts() { wp_dequeue_script( 'xxx' ); } add_action( 'wp_print_scripts', 'deq_scripts', 100 ); //of course I will try several hooks: add_action( wp_enqueue .., '// Styles function deq_styles() { wp_dequeue_style( 'xxx' ); } add_action( 'wp_print_styles', 'deq_styles', 100 ); // Scripts function deq_scripts() { wp_dequeue_script( 'xxx' ); } add_action( 'wp_print_scripts', 'deq_scripts', 100 ); //of course I will try several hooks: add_action( 'wp_enqueue .., or 'admin_enqueue ..., or 'admin_head', because those codes are generated by plugins
Back to Advanced Child, if you see the link I sent, the author is (was?) www.remarpro.com .. (it is a small child) .. strange that now it is not in the repository, no?
- This reply was modified 1 year, 8 months ago by Mauro Vicariotto.
Hey there – hmm, I’m not sure why the functions you’re adding to your premade third-party child theme aren’t working, but this does seem like a good moment to consider starting fresh with a new child theme you make yourself, using best practices. There’s also a step-by-step tutorial here.
Back to Advanced Child, if you see the link I sent, the author is (was?) www.remarpro.com
I see www.remarpro.com as the author of Twenty Seventeen, not the child theme. I see the author listed as
SaturnSolutions
, whose URL is now redirecting somewhere else.Themes and plugins are sometimes withdrawn from the www.remarpro.com directory if there are security issues that the author is unable or unwilling to fix, or when their creator wishes to erase their www.remarpro.com account.
Hi,
yes I agree with you, very probably the author of “Advanced” never put enough commitment and interest in the Child he published.
Probably that’s why the child is nothing, just added some classes with prefix “ats-xxx” to adjust some padding and margin, a couple of scripts (which I didn’t use, customizing all) and empty php (no header, no functions, only insignificant footer.php).I have no issues to create a couple of child themes to use in our sites, actually to create a child and synchronize it with the full set of codes takes probably just few hours.
But the only problem is the time for preparation, “before the job”: I have two activities (with base Overseas) to follow, which involve me over 18 hrs per day (so I usually do web design overnight, when world sleeps).
I know scripting but don’t know enough of WP, and what worries me is that I have just a rough idea of what will happen when I uninstall this (even useless) child theme.Of course I have an idea clear enough of the codes which are affecting the parent theme, either as css and js, but surely there are other dozens of code snippets that affect now, and that will change things when uninstalled: so I will need an in depth analysis before starting.
I have some questions that, if you kindly reply, allow me to save a lot of time: I will write you here (thank you).
FIRST: is the child theme located all and only in its folder in wp-content, or does it write tweals in other areas? (wp-admin, or main folder …).
Thank you: your support could help ne, saving precious time. ??- This reply was modified 1 year, 8 months ago by Mauro Vicariotto.
- This reply was modified 1 year, 8 months ago by Mauro Vicariotto.
FIRST: is the child theme ocated all and only in its folder in wp-content, or does it write tweals in other areas? (wp-admin, or main folder …).
A child theme is normally a self-contained folder at the top level of
/wp-content/themes
and does not affect other areas of the WP install.thank you Kathryn
in these dd I will probably ask you details
Dear Kathryn, I’ve done some in depth analysis about this child theme:
it is a very strange child, actually the child is just the “door” of a plugin,
and all is managed by it.
I confirm that all in wp-content but ..
themes:
themes/advanced-twenty-seventeen-child:
style.css (with just a couple of minor properties used by me, all based on prefix .atd-xxx)
functions.php (empty)
footer.php (with a small layout for footer in DOM, which I’m using)
two folders (“header” and “footer”) with 3 php at all of which I use 2 lines of one of them)
… stop, that’s all for wp-content/themes
plugins:
now the complications comes because all (included the theme) is related to a plugin named
“advanced-twenty-seventeen”.
It is a plugin composed with 352 files in 74 folders where the main parts are in inc:
an admin folder which is totally useless because consists of repeating the three of child theme ..
a folder of libraries,
subdivided in “assets” folder, with several css, scss and js codes totally ininfluent
(even most of css are totally blank codes, such as kirki-styles.css)
and an “includes” libray with 114 php recalling a “kirki class” related to a plugin called “kirki-toolkit”:
… and here comes the mess, because, testing, just a few of them really affect my DOM, and
all rest is useless (just useless weight) called “kirki toolkit”, managed by an autoloader.
All is done dynamically.
Now my problem is that I have to find a quick way to test which of them influences the few codes snippets used.
Just some “kirki classes php” affect the codes, no more than 2 or 3, but among over 200 scripts (!).
With development tools which I use it is no possible to detect this.
Or I have to manually read one by one the 200 or more scripts, taking notes and studying the interactions
between them: probably months overnight .. a crazy job (and as told ahead I have no such time).
Do you know a detecting tool for an automatic search?
I tested breaking the flow of groups of php kirky classes: they affect something in header and in footer widgets.
But believe me, it is a child really bad.
Now I understand why they disappeared.Wow, that does sound cumbersome.
The only thing I can think of is perhaps you could try asking in the Kirki Customizer Framework support forum – if this is indeed what you’re using – for some insight into what the framework does, and some ways to figure out how to detect what functionality is in use on your site.
Alternatively, you could making a copy of your site on a development server, then try deactivating the plugin and then exploring the site to see if anything is negatively affected. Unfortunately, I don’t know of an automated way to do this.
Yes Kathryn, it is cumbersome indeed! (over 3 mb of useless scripts).
Good idea, I will try to contact them, even if apparently they disappeared (if you see a single non-responsible person rarely answers, and most of the questions remain deserted), but I will try.
Yes, I already quickly tested deactivating group of scripts, the site is affected by few scripts, but all other are needed even if not used because all the 200 + scripts are interactive one each other: a mess.
I will move all on XAMPP and (guess) take (waste) long time to check one by one … (no comment).
you are wonderfully kind Kathryn. Thank you. Mauro
You’re very welcome, and I wish you lots of luck in this not-very-fun process! Cheers.
Thank You my friend. Hope to chat again in future
- The topic ‘functions.php’ is closed to new replies.