Been searching a lot for how to call a function in header.php where the function is in functions.php.

How do I solve this?

I have my function in functions.php like this:

function testFunction()
echo "This is a test";
  • you just call it in your header.php like that: <?php testFunction();?>. That's all – RRikesh Mar 19 '13 at 9:24
  • This looks like a pure PHP question to me. – s_ha_dum Mar 19 '13 at 13:30

Simple! just call it testFunction(); wherever you want between php tags.

But not a wp question

| improve this answer | |
  • 2
    Since this relates to the WordPress header and function files, surely this is a WP specific concern? – AdamMcquiff Jan 7 '18 at 14:47
  • This was about how to call a function within a set of files which OP obviously didn't hesitate to try basic things. Not wordpress specific. @AdamMcquiff – revo Jan 7 '18 at 14:50
  • In case someone wants a better answer: wordpress.stackexchange.com/questions/341965/… – Lisa Cerilli May 7 at 1:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.