search
HomeCMS TutorialWordPressJavaScript and PHP Libraries Used by WordPress

WordPress deeply relies on third-party JavaScript and PHP libraries, among which jQuery is the most widely used JavaScript library, and the PHP library is mainly composed of single class files. Other JavaScript libraries used include jQuery Masonry, jQuery Hotkeys, jQuery Suggest, jQuery Form, jQuery Color, jQuery Migrate, jQuery Schedule, jQuery UI, Backbone, colorpicker, hoverIntent, SWFObject, and TinyMCE.

WordPress's third-party library is located in the wp-includes and wp-admin folders along with WordPress files. The PHP library is named after class-*.php or is located in its own folder, while the JavaScript files are located in the js folder under these folders. The CSS file is mainly a jQuery or TinyMCE CSS file, located in the CSS folder under the include folder.

While these libraries enhance the functionality and user experience of WordPress, many are outdated, which has sparked discussions about architecture and potential improvements such as Bower and Composer integration into WordPress. Understanding these libraries can make you smarter, more efficient in using WordPress and potentially contribute to its core.

Almost all modern software (including platforms such as WordPress) rely on third-party libraries. This is because, as developers, we don't need to reinvent the wheel.

If I have to develop software that uses HTTP abstraction, I might use Symfony HttpKernel or similar packages. If my software needs more features (which is unlikely, by the way, but let's assume this in the example), I can extend the package, or in the worst case, create one from scratch. Creating from scratch is not a bad thing. It's actually a good thing because it makes you a better developer. But usually, in most modern projects, you have to rely on third-party libraries (or packages). In this article, we will look at various third-party JavaScript and PHP libraries used by WordPress.

List of libraries used in WordPress

In WordPress, third-party libraries exist together with WordPress files. To better understand the structure of files in WordPress, the WordPress codebase page will provide you with some answers. The wp-includes folder contains some libraries that are included when the application is executed. Also, in wp-admin you will find the second include folder, which works the same as the first one. In both folders, you will find the PHP and JavaScript files.

Third-party PHP libraries are named after class-*.php (single files) or are located in their own folder. Other PHP files named class-*.php may be WordPress files (rather than third-party files). The PHP file is located in the wp-include or wp-admin/include folder.

JavaScript files are also located under these folders, but they are grouped in js folders.

CSS files are mainly jQuery or TinyMCE CSS files, located in the CSS folder under the include folder.

JavaScript Library

Let's start with the JavaScript library. WordPress uses jQuery heavily. It uses:

  • jQuery
  • jQuery Masonry
  • jQuery Hotkeys
  • jQuery Suggest
  • jQuery Form
  • jQuery Color
  • jQuery Migrate
  • jQuery Schedule
  • jQuery UI

You may notice that some of these libraries have no links. This is because some of these libraries are very old and the repository no longer exists. Let's check them one by one.

jQuery is a well-known library that requires no introduction.

jQuery Masonry is a plugin that makes it easier to create masonry layouts like this:

JavaScript and PHP Libraries Used by WordPress Creating such a layout from scratch is a bit difficult, jQuery Masonry makes this easy.

jQuery Hotkeys Shortcut keys for processing browsers. If you are used to using tools like StackEdit.io, you may use "ctrl s" (command s) to save files on gDrive or other cloud providers. The default (ctrl s) shortcuts in the browser can be used to save web pages, and using this plugin you can override these default shortcuts.

jQuery Form handles forms and AJAX calls. If you are curious and want to learn more about this plugin, you can check out its documentation.

jQuery Color is used by WordPress for color manipulation and animation.

jQuery("#go").click(function(){
    jQuery("#block").animate({
            backgroundColor: "#abcdef"
    }, 1500 );
});

The first line selects the element with which it has and tells the browser that it should animate the background color of the element with which it has in 1.5 seconds.

jQuery Migrate can help you when dealing with early jQuery code bases. This is very important for WordPress because it is a platform that should be backward compatible.

In fact, backward compatibility is one of WordPress's most famous features. On the other hand, this is also one of the problems with WordPress. WordPress was released in 2003 and the PHP version used was outdated. Today, PHP is a modern language that draws on many useful features of other languages. But this is another topic, and it will be discussed in future articles.

WordPress also uses other JavaScript libraries, not just jQuery. Here are some other popular libraries it uses:

  • Backbone
  • colorpicker
  • hoverIntent (jQuery plugin located outside the jQuery folder)
  • SWFObject
  • TinyMCE

and so on.

The most famous ones on this list are TinyMCE and Backbone. TineMCE is used to write new posts and pages in WordPress dashboard.

Backbone is a front-end framework, and in fact it is one of the first ones. It is still in use today, but is losing a lot of market share in Angular and other front-end frameworks. Yes, I'm telling you, Meteor. But don't worry, in the JavaScript world, frameworks (libraries) are forgotten as quickly as they are popular.

PHP library

The list of PHP libraries is slightly different. We see that JavaScript is mainly influenced by jQuery and some other popular libraries. For PHP, the situation is different because most third-party libraries are just a class (file). Here is a short list of current third-party PHP libraries:

  • Atom Lib
  • Text Diff
  • SimplePie
  • Pomo
  • ID3
  • Snoopy
  • PHPMailer
  • POP3 Class
  • PHPass
  • PemFTP

Public discussion

Many libraries are a bit outdated. At this time, discussions on topics such as architecture often occur. I personally want to see Bower and Composer integrate with WordPress. I want to ask the SitePoint community about these ideas and have a public discussion on how to improve WordPress. Please leave your comments and thoughts below.

Conclusion

In this article, we see the various third-party libraries used by WordPress. Learn what WordPress is used behind the scenes and you will have a better understanding of how it works. The better you understand, the faster and more efficient you can use WordPress. Maybe you can even work hard to contribute to WordPress core. After all, this is an open source world where we learn from each other and share ideas (code and pizza!).

FAQs about JavaScript and PHP libraries used by WordPress

What is the most commonly used JavaScript library in WordPress?

WordPress uses multiple JavaScript libraries to enhance its functionality and user experience. The most commonly used libraries include jQuery, Backbone.js, and Underscore.js. jQuery is a fast, compact and feature-rich JavaScript library that simplifies HTML document traversal, event processing, and animation, allowing for fast web development. Backbone.js provides structure for web applications by providing a model with key-value binding and custom events. Underscore.js is a utility library that provides support for commonly used functional programming without extending any core JavaScript objects.

How does the PHP library enhance WordPress functionality?

The PHP library is a collection of classes and functions used to perform specific tasks in WordPress. They help enhance the functionality of WordPress by providing pre-written code to perform common tasks, saving developers time and effort. For example, PHPMailer is a code base for sending emails safely and easily through PHP code on a web server. Similarly, SimplePie is a PHP library that can read RSS and Atom feeds.

How to add JavaScript to my WordPress website?

There are several ways to add JavaScript to your WordPress site. One of the most commonly used methods is to use the wp_enqueue_script function. This function contains the specified JavaScript file in the page. Another way is to add JavaScript code directly to your theme file. However, this method should be used with caution, as it can cause problems if not properly operated.

What are some of the best PHP libraries developed by WordPress?

There are several PHP libraries that can help with WordPress development. Some of the most popular libraries include Guzzle (a PHP HTTP client that makes sending HTTP requests easy and easy to integrate with web services); Carbon (a simple PHP API extension for DateTime); and Monolog (it has Helps create logs).

Can I use third-party JavaScript libraries in my WordPress website?

Yes, you can use third-party JavaScript libraries in your WordPress website. However, be sure to make sure that the library does not conflict with any existing scripts on the website. Additionally, trusted sources should always be used when downloading third-party libraries to avoid security issues.

How to update PHP libraries in WordPress websites?

PHP libraries in WordPress websites can be updated by downloading the latest version of the library and replacing the old files with new ones. However, be sure to back up your website before making any changes to avoid losing any data.

What are some of the best WordPress plugins for managing media files?

There are several WordPress plugins that can help manage media files. Some of the most popular plugins include WP Media Folder (which allows you to organize media files in folders) and Smush (which helps optimize and compress images).

How to add JavaScript to a WordPress post or page?

JavaScript can be added to a WordPress post or page by using a custom HTML block in the Gutenberg editor. Simply paste your JavaScript code into the block and it will be included in the page when viewing it.

What are the benefits of using JavaScript and PHP libraries in WordPress?

Using JavaScript and PHP libraries in WordPress can greatly enhance the functionality and user experience of your website. They can help simplify complex tasks, improve performance, and provide other features that are difficult to implement from scratch.

Is there any risk using JavaScript and PHP libraries in WordPress?

While JavaScript and PHP libraries can provide many benefits, they can also pose risks if used incorrectly. For example, using outdated or poorly maintained libraries can lead to security vulnerabilities. Additionally, using too many libraries can negatively affect the performance of your website. Therefore, be sure to use the library carefully and keep it up to date.

The above is the detailed content of JavaScript and PHP Libraries Used by WordPress. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Can I learn WordPress in 3 days?Can I learn WordPress in 3 days?Apr 09, 2025 am 12:16 AM

Can learn WordPress within three days. 1. Master basic knowledge, such as themes, plug-ins, etc. 2. Understand the core functions, including installation and working principles. 3. Learn basic and advanced usage through examples. 4. Understand debugging techniques and performance optimization suggestions.

Is WordPress a CMS?Is WordPress a CMS?Apr 08, 2025 am 12:02 AM

WordPress is a Content Management System (CMS). It provides content management, user management, themes and plug-in capabilities to support the creation and management of website content. Its working principle includes database management, template systems and plug-in architecture, suitable for a variety of needs from blogs to corporate websites.

What is the WordPress good for?What is the WordPress good for?Apr 07, 2025 am 12:06 AM

WordPressisgoodforvirtuallyanywebprojectduetoitsversatilityasaCMS.Itexcelsin:1)user-friendliness,allowingeasywebsitesetup;2)flexibilityandcustomizationwithnumerousthemesandplugins;3)SEOoptimization;and4)strongcommunitysupport,thoughusersmustmanageper

Should I use Wix or WordPress?Should I use Wix or WordPress?Apr 06, 2025 am 12:11 AM

Wix is ​​suitable for users who have no programming experience, and WordPress is suitable for users who want more control and expansion capabilities. 1) Wix provides drag-and-drop editors and rich templates, making it easy to quickly build a website. 2) As an open source CMS, WordPress has a huge community and plug-in ecosystem, supporting in-depth customization and expansion.

How much does WordPress cost?How much does WordPress cost?Apr 05, 2025 am 12:13 AM

WordPress itself is free, but it costs extra to use: 1. WordPress.com offers a package ranging from free to paid, with prices ranging from a few dollars per month to dozens of dollars; 2. WordPress.org requires purchasing a domain name (10-20 US dollars per year) and hosting services (5-50 US dollars per month); 3. Most plug-ins and themes are free, and the paid price ranges from tens to hundreds of dollars; by choosing the right hosting service, using plug-ins and themes reasonably, and regularly maintaining and optimizing, the cost of WordPress can be effectively controlled and optimized.

Is WordPress still free?Is WordPress still free?Apr 04, 2025 am 12:06 AM

The core version of WordPress is free, but other fees may be incurred during use. 1. Domain names and hosting services require payment. 2. Advanced themes and plug-ins may be charged. 3. Professional services and advanced features may be charged.

Is WordPress easy for beginners?Is WordPress easy for beginners?Apr 03, 2025 am 12:02 AM

WordPress is easy for beginners to get started. 1. After logging into the background, the user interface is intuitive and the simple dashboard provides all the necessary function links. 2. Basic operations include creating and editing content. The WYSIWYG editor simplifies content creation. 3. Beginners can expand website functions through plug-ins and themes, and the learning curve exists but can be mastered through practice.

Why would anyone use WordPress?Why would anyone use WordPress?Apr 02, 2025 pm 02:57 PM

People choose to use WordPress because of its power and flexibility. 1) WordPress is an open source CMS with strong ease of use and scalability, suitable for various website needs. 2) It has rich themes and plugins, a huge ecosystem and strong community support. 3) The working principle of WordPress is based on themes, plug-ins and core functions, and uses PHP and MySQL to process data, and supports performance optimization.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor