child header.php
-
Hi.
Can you please provide an empty header.php for a child theme ?
I tested some suggestions from the internet and all of them did not work.
TIA
Guy
-
Dear Guy,
if you would like to make some modifications in the “header.php” template, please copy the original “header.php” into your child theme’s folder and make here the desired modifications. Your child theme’s “header.php” will override the equivalent file in the parent theme directory.
Here in the WordPress Codex, you can find more useful information about managing child themes.Best regards,
Tomas TomanThanks for the super fast reply.
Just a thought – I read here that it is not recommended nor needed to make a copy…. because when you will update the theme with a new version – boom I will have to re-copy and find my own lines of code and put them again…
from the page text:
The method you are describing is not advisable to import the functions from the parent theme header.php into the child theme’s header.php.
You could use an “include” or “require_once(‘../../maintheme/
But completely and utterly advising you not to, it’s bad mojo.
Is there a better way ?
Guy
It depends on what you need to edit in the “header.php”. For example, if you would like to modify some elements (menus, site title, etc.) in the “header.php”, then you will need to copy the original template. If you do not need to modify any default elements, then you could use an “include” or “require_once” (the mentioned post in the support topic which you have referenced only says that it is not recommended to use the “@import url” – the better way is to use the “include” or “require_once” for including the parent template).
Note: If you would like to add some script into the header, the best way how to do it is by using the wp_enqueue_script functions through your child theme’s “functions.php”.Best regards,
Tomas Toman – TT ThemesAgain thanks for the reply.
I am new to wordpress… that is why I do not know how to do it myself.
The only thing (at the moment) I need to do is to add two lines:
<script type=”text/javascript” src=”<?php echo get_stylesheet_directory_uri(); ?>/js/1.7.1/jquery-1.7.1.min.js”></script>
<script type=”text/javascript” src=”<?php echo get_stylesheet_directory_uri(); ?>/js/hidefieldsScript.js”></script>
Can you show me how to do it in a child header.php that will not be needed to be changed once I update the theme? (which is very nice one by the way…)
To attach a custom Javascript, you do not need to edit the “header.php”. Just add the following code into your child theme’s “functions.php” to enqueue the “hidefieldsScript.js” script (which has to be placed into the “js” sub-folder within your child theme’s main folder):
function minezine_child_scripts() { wp_enqueue_script( 'minezine-child-hidefields', get_stylesheet_directory_uri() . '/js/hidefieldsScript.js', array( 'jquery' ), '1.0.0', false ); } add_action( 'wp_enqueue_scripts', 'minezine_child_scripts' );Best regards,
Tomas TomanMany thanks again 🙂
You are welcome! 🙂
I had the same problem and thank God for Tomas because you are awesome! I wanted everyone to know that you are about the only few that not only sends frequent theme updates, but respond to peoples’ needs such as myself when we need the help. You are fast, professional and very helpful!
I personally know, because you took the time to help me numerous times when I need css customization and explained everything in detail for me to understand in layman’s terms. Many thanks to you and THANK YOU for all your help and support.
Sincerely,
EmineBTW when you get a chance look at my website. I’ve changed the website name and design and I’ve made numerous changes with all your help at casinobonuschips.org
I am happy for you!
Dear Emine,
thank you so much for your compliments, I greatly appreciate it! I always try to do my best to assist. 🙂
Best regards,
Tomas TomanHi Tomas,
I wat to use Minezine theme for my blog, but i dont have any knowledge on HTML, CSS or php. I want my blog to look standard. the name is http://www.nairaroot.com but i am not satisfied with the way it looks. I want to add my logo on the header (full span), i want my recent posts to display pictures, not just the tick that i am getting. I want to my footer to contain some info about the blo etc. can you please help me out on each steps?
Thanks Tomas. I look forward to hearing from you.
Regards.
@nairaroot – you need to start your own thread – please see the forum guidelines –
You can start a new thread on this theme sub-forum here:
The topic ‘child header.php’ is closed to new replies.
