How can I include 3rd party library in Wordpress?

I want to include this library on a single page. I'm pretty new to Wordpress, so I'm not sure how to do this. Is there a plugin which allows one to upload a library and then link to it in HTML of a page/post?

I tried uploading the plugin contents to my wp-content/uploads directory, but I always get 404 errors when trying to link to the library files, even though the paths are correct.

Topic third-party-applications Wordpress

Category Web


You have to include libraries CSS and JavaScript files to your theme (preferably in your Child Theme to keep customizations separate from the parent theme’s files). In order to do that you enqueue scripts and styles in the themes functions.php file. From the Including CSS & JavaScript Theme Handbook:

Enqueue the script or style using wp_enqueue_script() or wp_enqueue_style()

So you could upload CSS and JavaScript files to your themes directory and load them like that:

wp_enqueue_style( 'caption-style', get_template_directory_uri() . '/CaptionHoverEffects/component.css' );
wp_enqueue_script( 'caption-script', get_template_directory_uri() . '/CaptionHoverEffects/toucheffects.js' );

Enqueueing is the recommended method of linking JavaScript and Stylesheets to WordPress generated pages. Mostly it's to keep things running smoothly and let Wordpress handle the how and when of loading files and handling dependencies.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.