• router66

    (@router66)


    Hi, used an affiliate baner code of affili.net on my wp site (latest version WP).
    It is a java code (Sample pieces: <!– BEGIN PARTNER PROGRAM – DO NOT CHANGE THE PARAMETERS OF THE HYPERLINK –>
    <script type=”text/javascript” src=”http://banners.webmasterplan.com/view.asp?ref=833922&js=1&site=16774&b=16&target=_blank&title=Adzuna.de&#8221; >….. Now

    This code insterted on the Hemingway Theme, did not work on the single page editors and not putting it in with the snippet code plug in.
    The plug in stated: The code snippet you are trying to save produced a fatal error on line 1: syntax error, unexpected ‘<‘, expecting end of file.
    I could not find the syntax error (affiliate code is from their website).

    Hints on how to debug this would be great.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Hey,

    This issue is occurring because you can’t use pure HTML or JavaScript code with this plugin. Instead, you need to wrap it in some PHP code so it outputs in your site’s head section:

    add_action( 'wp_head', function () { ?>
    
    <script src="http://banners.webmasterplan.com/view.asp?ref=833922&js=1&site=16774&b=16&target=_blank&title=Adzuna.de">
    <!--- more html code here... -->
    
    <?php } );

    Any code that you put in between those first and last lines in that snippet will be output as HTML code in the <head> section of your site.

    Thread Starter router66

    (@router66)

    Hi,

    thanks a lot for that-the way I get it, wrapping it into the php lines, would then be able to be inserted by the “edit page” text mode, as well.

    Looking at website pages, on my theme there is a page.php. Does this include the code for all pages (since I want to add the baner code on a designated page)?

    Plugin Author Shea Bunge

    (@bungeshea)

    Sure, if you want to add a code snippet into a post, then you need to wrap it in PHP code to turn it into a shortcode:

    add_shortcode( 'my_shortcode', function () { ?>
    
    <p>shortcode content here</p>
    
    <?php } );

    Then you would use [my_shortcode] in posts to display the content.

    For your second question, take a look at the WordPress theme template hierarchy.

    Thread Starter router66

    (@router66)

    Hi, and thanks again. I will have to put that into practice.

    Best, Robert

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Fatal Error on WP site’ is closed to new replies.