Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 1st Oct 2013, 02:53 AM   #1
HyperActive Warrior
War Room Member
 
Craig Dawber's Avatar
 
Join Date: 2009
Posts: 231
Thanks: 15
Thanked 18 Times in 10 Posts
Default
Script error code message - How do I fix it???
Share on: 
fb share twitter share gplus share more share

Hi warriors,

I need your help please.

I have an offline client which I had a website built for their company but I seem to of messed up the site when adding a script to the site.

Message:
Hi Craig,

Please see the Lead Forensics client code for Richard Sheets Metals below;

<script type="text/javascript" src="http://lforen-cloud-trace.com/js/17549.js" async="async"></script>

Please could you copy and paste the relevant above code into the <head></head> element for all of your website pages.

After I added the script to the function.php in the wordpress editor setting I get this error message


Parse error: syntax error, unexpected '<' in /home2/webzappa/public_html/LaserCuttingMetalServices.co.uk/wp-content/themes/webzappa-child-theme/functions.php on line 60

I changed the functions.php code to below by adding the script at the end.

<?php
/** Start the engine **/
require_once( TEMPLATEPATH . '/lib/init.php' );
require_once( CHILD_DIR . '/lib/style.php' );

/** Child theme (do not remove) **/
define( 'CHILD_THEME_NAME', 'WEBZAPPA' );
define( 'CHILD_THEME_URL', 'http://www.webzappa.co.uk' );

/** Add support for custom background **/
add_custom_background();

/** Add support for custom header **/
add_theme_support( 'genesis-custom-header', array( 'width' => 960, 'height' => 100 ) );

/** Add support for 3-column footer widgets **/
add_theme_support( 'genesis-footer-widgets', 3 );

/** Add new image sizes **/
add_image_size( 'grid-thumbnail', 100, 100, TRUE );

/** Modify the size of the Gravatar in the author box **/
add_filter( 'genesis_author_box_gravatar_size', 'focus_gravatar_size' );
function focus_gravatar_size( $size ) {
return 80;
}

/** Add after post section **/
add_action( 'genesis_before_comments', 'focus_after_post_box' );
function focus_after_post_box() {
if ( is_single() )
require( CHILD_DIR . '/after-post.php' );
}

/** Register widget areas **/
genesis_register_sidebar( array(
'id' => 'after-post-left',
'name' => __( 'After Post Left', 'focus' ),
'description' => __( 'This is the left section after a post.', 'focus' ),
) );
genesis_register_sidebar( array(
'id' => 'after-post-right',
'name' => __( 'After Post Right', 'focus' ),
'description' => __( 'This is the right section after a post.', 'focus' ),
) );

//**Remove page/post title **/
remove_action('genesis_post_title', 'genesis_do_post_title');


//**Add copyright text to footer right side **/
add_filter('genesis_footer_creds_text', 'custom_footer_creds_text');
function custom_footer_creds_text($creds) {
$creds = 'Copyright &copy;
<script language=JavaScript>
today=new Date();
y0=today.getFullYear();
document.write(y0);
</script> &middot; <a href="http://www.lasercuttingmetalservices.co.uk/">Richards Sheet Metal Ltd</a> | Site Design By <a href="http://webzappa.co.uk" rel="nofollow" target="_blank">Web Zappa';

<script type="text/javascript" src="http://lforen-cloud-trace.com/js/17549.js" async="async"></script>
return $creds;

}
I have now taken out the script but I still get the error code and the site doesn't load.

Can anyone help me fix this please?

Thanks

Craig
Craig Dawber is offline  
Unread 1st Oct 2013, 03:08 AM   #2
HyperActive Warrior
War Room Member
 
Join Date: 2013
Location: Somewhere in Europe
Posts: 194
Thanks: 9
Thanked 28 Times in 25 Posts
Default
Re: Script error code message - How do I fix it???
Share on: 
fb share twitter share gplus share more share

Maybe check on a coding forum? There are mostly internet marketers here..
tdanz is offline  
Unread 1st Oct 2013, 04:30 AM   #3
Web Designer
 
Join Date: 2013
Posts: 70
Thanks: 0
Thanked 19 Times in 18 Posts
Default
Re: Script error code message - How do I fix it???
Share on: 
fb share twitter share gplus share more share

In the script you have not included the html code <script type="text/javascript" src="http://lforen-cloud-trace.com/js/17549.js" async="async"></script> inside the quotes, that’s why it’s giving the error. I think a better approach would be to separate the html from the php.

//**Add copyright text to footer right side **/
add_filter('genesis_footer_creds_text', 'custom_footer_creds_text');
function custom_footer_creds_text($creds) {
$creds = 'Copyright &copy';
?>
<script language=JavaScript>
today=new Date();
y0=today.getFullYear();
document.write(y0);
</script> &middot;
<a href="http://www.lasercuttingmetalservices.co.uk/">Richards Sheet Metal Ltd</a> | Site Design By <a href="http://webzappa.co.uk" rel="nofollow" rel="nofollow" target="_blank">Web Zappa</a>
<script type="text/javascript" src="http://lforen-cloud-trace.com/js/17549.js" async="async"></script>
<?php
return $creds;
}
Nathan K is offline  
Unread 1st Oct 2013, 06:46 AM   #4
VIP Warrior
War Room Member
 
SteveJohnson's Avatar
 
Join Date: 2007
Location: Caldwell, Idaho, USA.
Posts: 1,967
Thanks: 1,024
Thanked 2,043 Times in 1,183 Posts
Default
Re: Script error code message - How do I fix it???
Share on: 
fb share twitter share gplus share more share

You can't do as Nathan posted; it's a WP/Genesis filter and needs the output returned, not echoed.

Copy/paste the code below in place of what is there now at the bottom:


//**Add copyright text to footer right side **/
add_filter('genesis_footer_creds_text', 'custom_footer_creds_text');
function custom_footer_creds_text() {
$creds = 'Copyright &copy; ' . date('Y') . ' &middot; <a href="http://www.lasercuttingmetalservices.co.uk/">Richards Sheet Metal Ltd</a> | Site Design By <a href="http://webzappa.co.uk" rel="nofollow" rel="nofollow" rel="nofollow" target="_blank">Web Zappa</a>
<script type="text/javascript" src="http://lforen-cloud-trace.com/js/17549.js" async="async"></script>';
return $creds;
}
SteveJohnson is offline  
The Following User Says Thank You to SteveJohnson For This Useful Post:
Unread 1st Oct 2013, 08:03 AM   #5
HyperActive Warrior
War Room Member
 
Craig Dawber's Avatar
 
Join Date: 2009
Posts: 231
Thanks: 15
Thanked 18 Times in 10 Posts
Default
Re: Script error code message - How do I fix it???
Share on: 
fb share twitter share gplus share more share

That worked a treat Steve.

Thank you so much, you're a star!
Craig Dawber is offline  
Unread 1st Oct 2013, 08:42 AM   #6
Web Designer
 
Join Date: 2013
Posts: 70
Thanks: 0
Thanked 19 Times in 18 Posts
Default
Re: Script error code message - How do I fix it???
Share on: 
fb share twitter share gplus share more share

Yep my mistake, i should have notice the return part, glad you got it fixed.
Nathan K is offline  
Closed Thread


Bookmarks

Tags
code, error, fix, message, script


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 10:36 AM.