WordPress.org

Ready to get started?Download WordPress

Forums

add aweber code into page template (1 post)

  1. Micbow
    Member
    Posted 1 year ago #

    Hi I want to add an aweber java script code into a page template.

    Here's the php code I came up with

    <script type='text/javascript' src='<?php echo get_post_meta($post->ID, "aweber", true); ?>'></script>

    It works fine when 'aweber' exists in the database but I don't want it show when it doesn't exist. Which it does anyway (so what's the problem?).

    What I'd like to know is do I need to add this code into a php if statement that says only show the aweber form, "aweber", if "aweber" exists?

    For example

    $aweber="<script type='text/javascript' src=' . get_post_meta($post->ID, "aweber", true) . '></script>";
    ?>
    <?php  if ( get_post_meta($post->ID, 'aweber', true))
    	echo "$aweber"; ?>

    If I do need to put it into an if statement do I need to use the variable and how should it be written? as the if statement above doesn't work.

    Hope this makes sense.
    Thanks for your help.

Topic Closed

This topic has been closed to new replies.

About this Topic