1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to embed Aweber form inside of a WordPress PHP file?

Discussion in 'Web Design' started by referraldude, Dec 12, 2011.

  1. referraldude

    referraldude Registered Member

    Joined:
    Jan 19, 2010
    Messages:
    87
    Likes Received:
    50
    Location:
    The Devil's Den
    Hey all,

    I'm attempting to embed an aweber script inside of a php file for wordpress, which is a pre-designed optin form. I'm simply embedding two fields and a submit button with a transparent background. My coders said they don't know how to do this. Anybody here have an idea?

    I'll provide the code upon request if there's a response to this. If this can be done before start of business EST 12/13/11, I'll send some cash via paypal or something.

    Thanks!
     
    Last edited: Dec 12, 2011
  2. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,148
  3. dextor1372

    dextor1372 Regular Member

    Joined:
    Oct 4, 2008
    Messages:
    272
    Likes Received:
    274
    Occupation:
    6PS Co - CEO
    Location:
    Manchester, UK
    Home Page:
    either use the aweber plugin or feel free to pm me as I have very extensive working knowledge of aweber and wordpress.

    thanks
     
  4. referraldude

    referraldude Registered Member

    Joined:
    Jan 19, 2010
    Messages:
    87
    Likes Received:
    50
    Location:
    The Devil's Den
    I'm attempting to get this:

    HTML:
    <script type="text/javascript" src="http://forms.aweber.com/form/27/1472776027.js"></script>
    Into this:

    PHP:
    <?php

    class NewsletterWidgetCustom extends WP_Widget {
        function 
    NewsletterWidgetCustom(){
            
    parent::WP_Widget(false$name 'Newsletter Custom',
                array(
    'description' => 'Newsletter widget to add subscription forms on sidebars'),
                array(
    'width' => '350px'));
        }
        
        function 
    widget($args$instance) {
            global 
    $newsletter;
            
    extract($args);
            
            echo 
    $before_widget;
            
            
    $options get_option('newsletter');
            
    $options_profile get_option('newsletter_profile');
            
            
    $form '<span class="text-new">new</span>';
            
            if (!empty(
    $instance['t1'])){
                
    $form .= '<strong class="subhead">'.$instance['t1'].'</strong>';
            }
            
            if (!empty(
    $instance['t2'])){
                
    $form .= '<div class="heading-sidebar">'.
                            
    '<div class="heading-holder">'.
                                
    '<h4>'.str_replace(
                                    array(
    '['']'),
                                    array(
    '<span class="mark">''</span>'),
                                    
    $instance['t2']).
                                
    '</h4>'.
                            
    '</div>'.
                         
    '</div>';
            }
            
            if (!empty(
    $instance['text'])){
                
    $form .= wpautop(str_replace(
                                    array(
    '['']'),
                                    array(
    '<strong>''</strong>'),
                                    
    $instance['text'])
                                );
            }
            
            
            
    $form .= '<div class="newsletter newsletter-widget">'.
                        
    '<form action="'.$newsletter->options_main['url'].'" onsubmit="return newsletter_check(this)" '.
                            
    'method="post" class="report-form"><fieldset>'.
                        
                        
    '<input type="hidden" name="na" value="s"/>'.
                        
    '<input type="hidden" name="nr" value="widget"/>';
            
            if (
    $options_profile['name_status'] == 2){
                
    $form .= '<div class="row">'.
                            
    '<label for="name">Name</label>'.
                            
    '<span class="text"><input type="text" id="name" name="nn" value="'.$options_profile['name'].'"/></span>'.
                         
    '</div>';
            }
            
            if (
    $options_profile['surname_status'] == 2){
                
    $form .= '<div class="row">'.
                            
    '<label for="surname">Sname</label>'.
                            
    '<span class="text"><input type="text" id="surname" name="ns" value="'.$options_profile['surname'].'"/></span>'.
                         
    '</div>';
            }
            
            
    $form .= '<div class="row">'.
                        
    '<label for="email1">Email</label>'.
                        
    '<span class="text"><input type="text" id="email1" name="ne" value="'.$options_profile['email'].'"/></span>'.
                     
    '</div>';
            
            if (
    $options_profile['sex_status'] == 2){
                
    $form .= '<div class="row">'.
                            
    '<select name="nx" class="newsletter-sex">'.
                                
    '<option value="m">'.$options_profile['sex_male'].'</option>'.
                                
    '<option value="f">'.$options_profile['sex_female'].'</option>'.
                            
    '</select>'.
                         
    '</div>';
            }
            
            if (
    $options_profile['privacy_status'] == 1){
                
    $form .= '<div class="row"><input type="checkbox" name="ny"/> '.$options_profile['privacy'].'</div>';
            }
            
            
    $form .= '<input type="submit" class="submit" value="'.$options_profile['subscribe'].'"/>';
            
            if (!empty(
    $instance['ts'])){
                
    $form .= '<span class="info-text">'.$instance['ts'].'</span>';
            }
            
            
    $form .= '</fieldset></form></div>';
            
            if (!empty(
    $instance['t3'])){
                
    $form .= '<strong class="subtext">'.$instance['t3'].'</strong>';
            }
            
            echo 
    $form$after_widget;
        }
        
        function 
    update($new_instance$old_instance) {
            
    $instance $old_instance;
            
    $instance['t1'] = strip_tags($new_instance['t1']);
            
    $instance['t2'] = strip_tags($new_instance['t2']);
            
    $instance['text'] = strip_tags($new_instance['text']);
            
    $instance['ts'] = strip_tags($new_instance['ts']);
            
    $instance['t3'] = strip_tags($new_instance['t3']);
            return 
    $instance;
        }
        
        function 
    form($instance){
            
            
    ?><p><?php
                ?>
    <label for="<?php echo $this->get_field_id('t1');?>"><?php
                    ?>
    Title 1:<?php
                    ?>
    <input class="widefat" id="<?php echo $this->get_field_id('t1');?>" name="<?php
                        
    echo $this->get_field_name('t1');?>" type="text" value="<?php echo esc_attr($instance['t1']);?>"/><?php
                ?>
    </label><?php
            ?>
    </p><?php
            ?>
    <p><?php
                ?>
    <label for="<?php echo $this->get_field_id('t2');?>"><?php
                    ?>
    Title 2:<?php
                    ?>
    <input class="widefat" id="<?php echo $this->get_field_id('t2');?>" name="<?php
                        
    echo $this->get_field_name('t2');?>" type="text" value="<?php echo esc_attr($instance['t2']);?>"/><?php
                ?>
    </label><?php
            ?>
    </p><?php
            ?>
    <p><?php
                ?>
    <label for="<?php echo $this->get_field_id('text');?>"><?php
                    ?>
    Text:<?php
                    ?>
    <textarea class="widefat" rows="10" cols="20" id="<?php echo $this->get_field_id('text');?>" name="<?php
                        
    echo $this->get_field_name('text');?>"><?php echo esc_html($instance['text']);?></textarea><?php
                ?>
    </label><?php
            ?>
    </p><?php
            ?>
    <p><?php
                ?>
    <label for="<?php echo $this->get_field_id('ts');?>"><?php
                    ?>
    Title Under "Submit":<?php
                    ?>
    <input class="widefat" id="<?php echo $this->get_field_id('ts');?>" name="<?php
                        
    echo $this->get_field_name('ts');?>" type="text" value="<?php echo esc_attr($instance['ts']);?>"/><?php
                ?>
    </label><?php
            ?>
    </p><?php
            ?>
    <p><?php
                ?>
    <label for="<?php echo $this->get_field_id('t3');?>"><?php
                    ?>
    Title 3:<?php
                    ?>
    <input class="widefat" id="<?php echo $this->get_field_id('t3');?>" name="<?php
                        
    echo $this->get_field_name('t3');?>" type="text" value="<?php echo esc_attr($instance['t3']);?>"/><?php
                ?>
    </label><?php
            ?>
    </p><?php
            
        
    }
    }

    add_action('widgets_init'create_function(EMPTY_STRING'return register_widget("NewsletterWidgetCustom");'));
    And to delete the php form fields and submit button, which will be replaced by the script. Not a coder myself, so I'm not sure how to get this to work.

    Any help would be appreciated.