You maybe need to enqueue the js file after jQuery or any other library. It also depends on how you want to implement this (with your theme or plugin), but it’s another question.
You need to read more about wp_enqueue_scripts
action to register and enqueue in the right way and see into Discord manual to see exactly which library and dependancies you have to respect to make it work.
function wpse_250336() {
wp_enqueue_script('jquery');
wp_enqueue_script( 'discord', trailingslashit( get_template_directory_uri() ) . 'js/discord.min.js', array('jquery') );
}
add_action( 'wp_enqueue_scripts', 'wpse_250336' );
Hope it helps a little !
Related Posts:
- Executing Javascript When a Widget is Added in the Backend
- Loading scripts only if a particular shortcode or widget is present
- How to refresh Theme Customizer after change color inside wpColorPicker?
- Elegantly using JavaScript on widget admin forms
- Run JS after widget settings are saved?
- AJAX Contact Form Issue
- Widget code is not working on WordPress.com Hosted Blogs
- Include chat (HTML, js, css) in all pages of WordPress
- How to determine the number of widgets contained in a sidebar via customizer JS
- jQuery UI inside widget on admin page
- WP_enqueue_script() loads them always in wp_footer()?
- How do I pass the id of my widget to javascript in the form function?
- Access Customizer widget instance form
- Unable to load “wpColorPicker” on theme customize page
- Render repeatable widget fields properly with Backbone.js
- Widget outputting JS as plain text
- Loading scripts only if a particular shortcode or widget is present
- Widget Admin page and Javascript enqueuing
- List.js inside WordPress widget
- Add text to Text Widget using Javascript
- How Can I Add the “Insert From URL” Tab to a Custom 3.5 Media Uploader?
- How to Remove All Widgets from Dashboard?
- How do I rebind event after widget save
- Calling static method in the Widget Class
- What is the best way to include a widget in a Page?
- Difference between widget form code variables
- Custom shortcode in widget forced to top of widget
- How to process content in a widget? [duplicate]
- How to retrive widget title/data
- Separate backend “Widgets” page for each language
- How do I embed in a text widget?
- Where (what direcory) are the default WordPress Widget Codes stored?
- check for shortcode in post/pages AND widgets AND template files
- Why can’t I add this feed to the RSS widget?
- WordPress Widget multiple use
- Contact Form in sidebar [closed]
- Display the date before the post title in recent posts widget
- Using Advanced Custom Fields in a widget
- Why won’t my custom widget stay in the sidebar after a reload?
- How to “pair” two widgets side by side in one sidebar [closed]
- Custom dashboard widget search box
- Notice: Undefined index: filter in …wp-includes/default-widgets.php on line 382
- Need some help understanding widgets
- register widget class not written in theme
- Font awesome Icon HTML in widgets disappear on save
- WordPress Plugins won’t save
- for class wp_widget, in what order are the member functions called?
- unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘)’ in widget [closed]
- How can hide widget title if custom widget is empty
- styling back end widget form and enabling multi widget feature
- How to show different widgets on different pages in a user friendly way
- A form in a custom widget
- Block-based Widgets Editor – how to enable a title
- How to transform a legacy widget into a block
- Elementor widgets – conditional controls
- Widgets in home.php redirect to index.php
- How to make a can’t hide widget?
- WordPress Tag Cloud args (font-size) not working since wp update 4.9
- Problem creating an array instance in a widget in 4.4 update
- Redirect to page after a widget form submit
- Widget on the right side of the page overlaps with the left side [closed]
- Where to put custom widget file?
- How to get options of all active widgets ?
- How to pass a special CSS class into widget li
- Show Woocommerce Product “attributes/extra information tab” in widget [closed]
- How to use the widget area to extend the page content?
- Display a widget on a specific type of archive
- Add a specific css to a widget
- Is there a simple way to have a new sidebar for each page?
- Select two value from meta key and post meta
- Removing widget from home page when coming from specific landing page
- In which folder can we find the core wordpress Widgets such as Menu Widget
- How do I insert an amazon search widget into posts or pages?
- How to remove Help tab and the Dashboard widget area’s empty border
- Add drop down to widget if it is in a certain area
- using get_template_part() inside a widget and passing variables
- New Widget are not showing
- How do I exclude portrait pictures from the nextgen gallery sidebar widget?
- How to use multiple instances of Deal or Announcement With Countdown Timer Plugin Widget
- How to remove date in Recent Post widget?
- Truncate Widget Title
- Script widget works only in admin view but not in Public
- Widgets are not displaying in my theme
- how to make video autoplay in widget
- Custom archive widget drop down menu
- Prevent widgets from disappearing when swtiching from parent to child theme
- Stop ‘extends WP_Widget’ displaying the (backend) form, frontend?
- How to add WooCommerce Add to Cart button in widget?
- How to place a widget beside a div/text so that they display as a continuous line
- Editor Widget Role
- How can I build a widget area widget using the built in WordPress functionalities?
- How to Activate WordPress Widgets
- WordPress wiget admin panel
- Filter “widget_comments_args” won’t work
- How to display a widget available for all themes
- How to output built-in widgets with number in range as class?
- widgets in contacts only
- How to hide sidebar widgets in all pages except Hompage?
- Extending Widgets – Exclude # of posts field from Recent Posts Widget
- Widget block editor: Unable to collect checkbox values inside widget update() method