![]() | | ||||||||
| | #1 |
| I Make it Rain War Room Member Join Date: Jan 2009 Location: Alabama
Posts: 1,979
Blog Entries: 10 Thanks: 537
Thanked 569 Times in 296 Posts
|
Warriors, I am trying to put in a line of Javascript into the header information in Wordpress - but it's written in php. I know I have to use the "echo" command and have been messing with it for 4 hours now. Now - I'm just plain begging for help. The code looks like this: ----------------------------------------------------------- echo $output_line; $seo_meta_tags = get_option( "gn_seo_meta_tags" ); if ( $seo_meta_tags == 'on' ) { $seo_meta_desc = get_option( "gn_seo_meta_desc" ); $seo_meta_keyw = get_option( "gn_seo_meta_keyw" ); $seo_meta_author = get_option( "gn_seo_meta_author" ); $output_line = ' <meta name="keywords" content="' . $seo_meta_keyw . '" />' . "\n" . ' <meta name="description" content="' . $seo_meta_desc . '" />' . "\n" . ' <meta name="author" content="' . $seo_meta_author . '" />' . "\n"; echo $output_line; } --------------------------------------------------------------- That's just a small part of the header.php code and I am trying to insert a line of javascript sort of like this... <script type="javascript"><src="http://whatever_source_is"></script> Like I said - I have been at it for 4 hours or so and cannot get anything to work. Any ideas? |
| sign up for ~good stuff~ | $20k in 13 Days? | HANDS FREE Income | Page 1 in 15 Minutes? "Knowledge is NOT power...ACTION on Knowledge is power" | |
| | |
| | #2 |
| HyperActive Warrior Join Date: Feb 2009 Location: Massachusetts
Posts: 168
Blog Entries: 34 Thanks: 5
Thanked 11 Times in 10 Posts
|
Maybe try this? echo $output_line; $seo_meta_tags = get_option( "gn_seo_meta_tags" ); if ( $seo_meta_tags == 'on' ) { $seo_meta_desc = get_option( "gn_seo_meta_desc" ); $seo_meta_keyw = get_option( "gn_seo_meta_keyw" ); $seo_meta_author = get_option( "gn_seo_meta_author" ); $output_line = ' <meta name="keywords" content="' . $seo_meta_keyw . '" />' . "\n" . ' <meta name="description" content="' . $seo_meta_desc . '" />' . "\n" . ' <meta name="author" content="' . $seo_meta_author . '" />' . "\n" . ' <script type="javascript"><src="http://whatever_source_is"></script> ' . "\n"; echo $output_line; } |
| | |
| | |
| | #3 |
| I am not a cowboy War Room Member Join Date: Apr 2007 Location: Caldwell, Idaho, USA.
Posts: 1,648
Thanks: 236
Thanked 494 Times in 343 Posts
|
find a spot in the <head> section and paste your script code as-is. You'll want to stay out of the PHP sections. In other words, paste after the <head> tag, and before an opening <?php tag. You don't need to be in that section you posted the code to. If all else fails, PM me. We can fix this in a jif. |
|
this area under construction
| |
| | |
| | #4 | |
| Senior Warrior Member War Room Member Join Date: Nov 2006 Location: , , .
Posts: 2,463
Thanks: 1,046
Thanked 1,120 Times in 373 Posts
| Quote:
Code: <script type="javascript" src="http://whatever_source.js"></script> | |
| | ||
| | |
| | #5 |
| I Make it Rain War Room Member Join Date: Jan 2009 Location: Alabama
Posts: 1,979
Blog Entries: 10 Thanks: 537
Thanked 569 Times in 296 Posts
|
Steve - the entire header.php file is in php There's no html in it - thats why I'm having such a hard time. Gonna try the fix above and then you may get a PM from me. Thanks! Blackwaterblog - thanks but it didn't work Steve - PM sent |
| sign up for ~good stuff~ | $20k in 13 Days? | HANDS FREE Income | Page 1 in 15 Minutes? "Knowledge is NOT power...ACTION on Knowledge is power" | |
| | |
| | #6 |
| HyperActive Warrior Join Date: Feb 2009 Location: Massachusetts
Posts: 168
Blog Entries: 34 Thanks: 5
Thanked 11 Times in 10 Posts
|
You must have a strange theme then, would you mind posting the code up to the <body> tag? Don't think I've ever seen a WP theme with full php code for the header information before. Here's a little preview of my theme header.php; |
| | |
| | |
![]() |
|
| Tags |
| assistance, javascript, php, wordpress |
| Thread Tools | |
| |
![]() |