Site logo

Archived topic

How can I change header.php in child theme?

3 replies · Started by Lee on April 26, 2020

Viewing posts 1–4 of 4

I installed child theme provided by GP.

[First question]
I want to add a specific tag to the code in header.php.
For example

<body <? php body_class (); ?> <? php generate_do_microdata ('body'); ?>>

<body <? php body_class (); ?> <? php generate_do_microdata ('body'); ?> oncontextmenu = "return false" ondragstart = "return false" onselectstart = "return false">

I want to change the code above to the code below.
Currently, the generatepress_child folder contains only functions.php, style.css, and screenshot.png.
How do I change a specific part of header.php?

Can I change only what I want?
I would like to fix the problem by changing the php without using plugins and GP elements.

[Second question]
I installed child theme provided by GP.

If you add the style code to style.css in the child theme folder, will the style.css of the parent theme be read first and then the style.css of the child theme?

I want to add the completed style code to the style.css of the child theme without using the CSS plugin because the site's style code is complete.

Hi there,

1. You'd need to copy the original header.php file and paste it into the child theme folder then edit the code here:
https://github.com/tomusborne/generatepress/blob/master/header.php

2.

If you add the style code to style.css in the child theme folder, will the style.css of the parent theme be read first and then the style.css of the child theme?

Yes that's how child theme works.

Thanks for the answer.

No problem :)

This archived topic is closed to new replies.