Skip to main content
deleted 81 characters in body
Source Link
user60726
user60726

I've been working on a plugin that adds a script to the sidebar when activated. So far, I've been able to display the code, but it loads at the bottom of the page and not in the sidebar.

I'm pretty new to developing WordPress plugins, so more detailed instructions would be greatly appreciated.

Here's the link to the code on Github.

   /**
 * Front-end display of widget.
 *
 * @see WP_Widget::widget()
 *
 * @param array $args     Widget arguments.
 * @param array $instance Saved values from database.
 */
   

    public function widget( $args, $instance ) {
        
    echo $args['before_widget'];
    if ( ! empty( $instance['title'] ) ) {
        echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
        }
 
      wp_enqueue_script( 'external-script', 'https://d21djfthp4qopy.cloudfront.net/humanitybox.js', array( 'jquery' ), '1.0.0', true );
      
        
        
     //echo __( 'Hello, World!', 'text_domain' );
     echo $args['after_widget'];
       
        

}

https://github.com/ModMarc/WordPress-Humanity-Box-Widget/blob/master/Widget.php

I've been working on a plugin that adds a script to the sidebar when activated. So far, I've been able to display the code, but it loads at the bottom of the page and not in the sidebar.

I'm pretty new to developing WordPress plugins, so more detailed instructions would be greatly appreciated.

Here's the link to the code on Github.

   /**
 * Front-end display of widget.
 *
 * @see WP_Widget::widget()
 *
 * @param array $args     Widget arguments.
 * @param array $instance Saved values from database.
 */
   

    public function widget( $args, $instance ) {
        
    echo $args['before_widget'];
    if ( ! empty( $instance['title'] ) ) {
        echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
        }
 
      wp_enqueue_script( 'external-script', 'https://d21djfthp4qopy.cloudfront.net/humanitybox.js', array( 'jquery' ), '1.0.0', true );
      
        
        
     //echo __( 'Hello, World!', 'text_domain' );
     echo $args['after_widget'];
       
        

}

https://github.com/ModMarc/WordPress-Humanity-Box-Widget/blob/master/Widget.php

I've been working on a plugin that adds a script to the sidebar when activated. So far, I've been able to display the code, but it loads at the bottom of the page and not in the sidebar.

I'm pretty new to developing WordPress plugins, so more detailed instructions would be greatly appreciated.

Here's the link to the code on Github.

   /**
 * Front-end display of widget.
 *
 * @see WP_Widget::widget()
 *
 * @param array $args     Widget arguments.
 * @param array $instance Saved values from database.
 */
   

    public function widget( $args, $instance ) {
        
    echo $args['before_widget'];
    if ( ! empty( $instance['title'] ) ) {
        echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
        }
 
      wp_enqueue_script( 'external-script', 'https://d21djfthp4qopy.cloudfront.net/humanitybox.js', array( 'jquery' ), '1.0.0', true );
      
        
        
     //echo __( 'Hello, World!', 'text_domain' );
     echo $args['after_widget'];
       
        

}
added 813 characters in body
Source Link
user60726
user60726

I've been working on a plugin that adds a script to the sidebar when activated. So far, I've been able to display the code, but it loads at the bottom of the page and not in the sidebar.

I'm pretty new to developing WordPress plugins, so more detailed instructions would be greatly appreciated.

Here's the link to the code on Github.

   /**
 * Front-end display of widget.
 *
 * @see WP_Widget::widget()
 *
 * @param array $args     Widget arguments.
 * @param array $instance Saved values from database.
 */
   

    public function widget( $args, $instance ) {
        
    echo $args['before_widget'];
    if ( ! empty( $instance['title'] ) ) {
        echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
        }
 
      wp_enqueue_script( 'external-script', 'https://d21djfthp4qopy.cloudfront.net/humanitybox.js', array( 'jquery' ), '1.0.0', true );
      
        
        
     //echo __( 'Hello, World!', 'text_domain' );
     echo $args['after_widget'];
       
        

}

https://github.com/ModMarc/WordPress-Humanity-Box-Widget/blob/master/Widget.php

I've been working on a plugin that adds a script to the sidebar when activated. So far, I've been able to display the code, but it loads at the bottom of the page and not in the sidebar.

I'm pretty new to developing WordPress plugins, so more detailed instructions would be greatly appreciated.

Here's the link to the code on Github.

https://github.com/ModMarc/WordPress-Humanity-Box-Widget/blob/master/Widget.php

I've been working on a plugin that adds a script to the sidebar when activated. So far, I've been able to display the code, but it loads at the bottom of the page and not in the sidebar.

I'm pretty new to developing WordPress plugins, so more detailed instructions would be greatly appreciated.

Here's the link to the code on Github.

   /**
 * Front-end display of widget.
 *
 * @see WP_Widget::widget()
 *
 * @param array $args     Widget arguments.
 * @param array $instance Saved values from database.
 */
   

    public function widget( $args, $instance ) {
        
    echo $args['before_widget'];
    if ( ! empty( $instance['title'] ) ) {
        echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
        }
 
      wp_enqueue_script( 'external-script', 'https://d21djfthp4qopy.cloudfront.net/humanitybox.js', array( 'jquery' ), '1.0.0', true );
      
        
        
     //echo __( 'Hello, World!', 'text_domain' );
     echo $args['after_widget'];
       
        

}

https://github.com/ModMarc/WordPress-Humanity-Box-Widget/blob/master/Widget.php

Source Link
user60726
user60726

Widget Script Loads at Bottom of Page

I've been working on a plugin that adds a script to the sidebar when activated. So far, I've been able to display the code, but it loads at the bottom of the page and not in the sidebar.

I'm pretty new to developing WordPress plugins, so more detailed instructions would be greatly appreciated.

Here's the link to the code on Github.

https://github.com/ModMarc/WordPress-Humanity-Box-Widget/blob/master/Widget.php