php code added to head not executing
-
I’m trying to write my first plugin and am running into several problems. The first one I want to tackle is how to echo a line to the head of a post page. The line should look like this “<link rel=”author” “” />” and instead it looks like this “<link rel=”author” href=”<?php echo $curauth->google; ?>” />” when I view the page source.
Here’s some of the code I’ve been using:
/*Get current author if (is_admin()) require_once(ABSPATH . 'wp-includes/pluggable.php'); if(isset($_GET['author_name'])) : $curauth = get_userdatabylogin($author_name); else : $curauth = get_userdata($author); endif; Add Google profile to HEAD */ add_action('wp_head', 'add_google_rel_author'); function add_google_rel_author() { echo '<link rel="author" href="<?php echo $curauth->google; ?>" />'; }
The first part is commented out because it returns an error when I enable it – Function get_userdata is undefined.
What am I doing wrong?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘php code added to head not executing’ is closed to new replies.