Go Back   WarriorForum - Internet Marketing Forums > The Warrior Forum > Main Internet Marketing Discussion Forum
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
LinkBack Thread Tools
Old 07-12-2009, 03:06 PM   #1
I Make it Rain
War Room Member
 
winebuddy's Avatar
 
Join Date: Jan 2009
Location: Alabama
Posts: 1,979
Blog Entries: 10
Thanks: 537
Thanked 569 Times in 296 Posts
Social Networking View Member's Twitter Profile  View Member's YouTube Profile
Contact Info
Send a message via Skype™ to winebuddy
Default Php and Javascript in Wordpress - a little assistance please?

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"
winebuddy is offline   Reply With Quote
Old 07-12-2009, 03:12 PM   #2
HyperActive Warrior
 
BlackWaterBlog's Avatar
 
Join Date: Feb 2009
Location: Massachusetts
Posts: 168
Blog Entries: 34
Thanks: 5
Thanked 11 Times in 10 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via AIM to BlackWaterBlog Send a message via MSN to BlackWaterBlog
Default Re: Php and Javascript in Wordpress - a little assistance please?

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;
}

BlackWaterBlog is offline   Reply With Quote
Old 07-12-2009, 03:16 PM   #3
I am not a cowboy
War Room Member
 
SteveJohnson's Avatar
 
Join Date: Apr 2007
Location: Caldwell, Idaho, USA.
Posts: 1,648
Thanks: 236
Thanked 494 Times in 343 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Yahoo to SteveJohnson Send a message via Skype™ to SteveJohnson
Default Re: Php and Javascript in Wordpress - a little assistance please?

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
SteveJohnson is offline   Reply With Quote
Old 07-12-2009, 03:24 PM   #4
Senior Warrior Member
War Room Member
 
Andy Fletcher's Avatar
 
Join Date: Nov 2006
Location: , , .
Posts: 2,463
Thanks: 1,046
Thanked 1,120 Times in 373 Posts
Contact Info
Send a message via AIM to Andy Fletcher Send a message via MSN to Andy Fletcher Send a message via Skype™ to Andy Fletcher
Default Re: Php and Javascript in Wordpress - a little assistance please?

Quote:
<script type="javascript"><src="http://whatever_source_is"></script>
I imagine this is just a mistake in typing it out here but just incase that should be -

Code:
<script type="javascript" src="http://whatever_source.js"></script>

Andy Fletcher is online now   Reply With Quote
Old 07-12-2009, 03:24 PM   #5
I Make it Rain
War Room Member
 
winebuddy's Avatar
 
Join Date: Jan 2009
Location: Alabama
Posts: 1,979
Blog Entries: 10
Thanks: 537
Thanked 569 Times in 296 Posts
Social Networking View Member's Twitter Profile  View Member's YouTube Profile
Contact Info
Send a message via Skype™ to winebuddy
Default Re: Php and Javascript in Wordpress - a little assistance please?

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"
winebuddy is offline   Reply With Quote
Old 07-12-2009, 03:32 PM   #6
HyperActive Warrior
 
BlackWaterBlog's Avatar
 
Join Date: Feb 2009
Location: Massachusetts
Posts: 168
Blog Entries: 34
Thanks: 5
Thanked 11 Times in 10 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via AIM to BlackWaterBlog Send a message via MSN to BlackWaterBlog
Default Re: Php and Javascript in Wordpress - a little assistance please?

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;


BlackWaterBlog is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > The Warrior Forum > Main Internet Marketing Discussion Forum

Tags
assistance, javascript, php, wordpress

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 01:51 AM.