I have a lot to add on the header file because of if/else condition. And it makes the file very messy. So, I have decided to include another file...
So how to add it:
- Creating a function file and add it with do_action()
- Getting a template file get_template_part()
I have a lot to add on the header file because of if/else condition. And it makes the file very messy. So, I have decided to include another file...
So how to add it:
- Creating a function file and add it with do_action()
- Getting a template file get_template_part()
- In which part of header.php? inside <body>? And what exactly do you want to put in there? – Krzysiek Dróżdż Commented Jan 8, 2020 at 8:24
- Yes, inside body. For logo and social icons when it is set(custom image) the header with logo will appear differently from not define the custom header image. – webfuelcode Commented Jan 8, 2020 at 10:48
1 Answer
Reset to default 0In my development experience.
get_template_part() is better way to maintain In the future.
https://developer.wordpress/reference/functions/get_template_part/