Timeline for Conditional wp_enqueue_script on a page
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 1, 2011 at 20:09 | comment | added | Rarst |
I disagree that add_action() must be in functions.php . Even though it is common (and good) practice it is not always possible/desireable/easy to have all adds centralized. I mentioned in my answer that it should be put before wp_head() call if kept in template.
|
|
Aug 1, 2011 at 19:02 | comment | added | Chip Bennett |
I should have clarified: the OP states that the add_action() call is in the template file; that's the one that should be moved to functions.php . But even WRT technical nuance, the template loads at a different point in the execution from when functions.php loads, so adding add_action() calls in the template file might not work, from a technical perspective, depending on what hook is being called.
|
|
Aug 1, 2011 at 18:37 | comment | added | Rarst |
I am merely stating technical nuance, not claiming that everything in template would be best practice. Also as per original question function definition itself is in functions.php , they only want hook directive in template (which is just fine as for me).
|
|
Aug 1, 2011 at 18:05 | comment | added | Chip Bennett |
I disagree. for various reasons, function definitions belong in functions.php .
|
|
Aug 1, 2011 at 15:48 | comment | added | Rarst |
Moving to functions.php not really required. If it's more convenient to keep this in template there is no issue with that.
|
|
Aug 1, 2011 at 12:35 | history | answered | Chip Bennett | CC BY-SA 3.0 |