template include - Should I use do_action in the header file?

I have a lot to add on the header file because of ifelse condition. And it makes the file very messy. So, I have decide

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:

  1. Creating a function file and add it with do_action()
  2. 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:

  1. Creating a function file and add it with do_action()
  2. Getting a template file get_template_part()
Share Improve this question asked Jan 8, 2020 at 7:27 webfuelcodewebfuelcode 212 bronze badges 2
  • 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
Add a comment  | 

1 Answer 1

Reset to default 0

In my development experience.
get_template_part() is better way to maintain In the future.

https://developer.wordpress/reference/functions/get_template_part/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744851006a4597124.html

相关推荐

  • template include - Should I use do_action in the header file?

    I have a lot to add on the header file because of ifelse condition. And it makes the file very messy. So, I have decide

    2天前
    60

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信