[wp_head] Should i hook functions to wp_head or place them in header.php?
-
Hi, (think i posted this one in a wrong section, sorry for that)
Question again. Hope someone can explain this.
I am used to code the title, charset meta, html5shiv line etc in the header.php.
I want to cleanup this file a litle bit so i hooked it via the add_action function like:add_action('wp_head', 'cahe_charset_meta', 1); add_action('wp_head', 'cahe_responsive_website_meta', 1); add_action('wp_head', 'cahe_favicon', 1); add_action('wp_head', 'cahe_site_title', 1); add_action('wp_head', 'register_cahe_html5_shiv_script', 1); add_action('wp_head', 'cahe_show_custom_css', 90); add_action('wp_head', 'cahe_analytics_script', 100);
This will output the head in the same way as is was before i hooked it and it seems to work. But is this ok to do it this way?
Some reasons for doing it this way:
One: The header is much cleaner.
Two: I can edit/manipulate it all via one core_functions file.
Three: I dont need to make if function exists around it in the header.php file couse its coded in core_functions.php.
Four: I can change priority of the output.Again, is this ok to do so? Or should i code the functions in the header.php
?
- The topic ‘[wp_head] Should i hook functions to wp_head or place them in header.php?’ is closed to new replies.