Jump to content

using a add_action in wordpress to add php to header

- - - - -

  • Please log in to reply
No replies to this topic

#1
jessygirl89

jessygirl89

    Newbie

  • Members
  • Pip
  • 1 posts
hey guys, i'm trying to insert php code into the header of wordpress using the "add_action" from a wordpress plugin.

My code looks something like this:

<?php


some php code here

some php code here

some php code here

some php code here


function functionname(){

echo '<?php [B]php code here[/B] ?>';}

add_action('wp_head','functionname');


?>

When I activate the plugin I get this error:
[B]Parse error: syntax error, unexpected T_INCLUDE_ONCE[/B]

this function works fine when I use html but gives me this error when i use php? anyone know how to fix this? OR anyone know an alternative so I can add php to the header of wordpress from a wordpress plugin?

thanks guys :)
jess




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users