JavaScript 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:
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Blogs are the ideal platform for people to express their opinions, opinions and opinions online. Many newbies are eager to build their own website but are hesitant to worry about technical barriers or cost issues. However, as the platform continues to evolve to meet the capabilities and needs of beginners, it is now starting to become easier than ever. This article will guide you step by step how to build a WordPress blog, from theme selection to using plugins to improve security and performance, helping you create your own website easily. Choose a blog topic and direction Before purchasing a domain name or registering a host, it is best to identify the topics you plan to cover. Personal websites can revolve around travel, cooking, product reviews, music or any hobby that sparks your interests. Focusing on areas you are truly interested in can encourage continuous writing

There are four ways to adjust the WordPress article list: use theme options, use plugins (such as Post Types Order, WP Post List, Boxy Stuff), use code (add settings in the functions.php file), or modify the WordPress database directly.

Do you want to know how to display child categories on the parent category archive page? When you customize a classification archive page, you may need to do this to make it more useful to your visitors. In this article, we will show you how to easily display child categories on the parent category archive page. Why do subcategories appear on parent category archive page? By displaying all child categories on the parent category archive page, you can make them less generic and more useful to visitors. For example, if you run a WordPress blog about books and have a taxonomy called "Theme", you can add sub-taxonomy such as "novel", "non-fiction" so that your readers can

Recently, we showed you how to create a personalized experience for users by allowing users to save their favorite posts in a personalized library. You can take personalized results to another level by using their names in some places (i.e., welcome screens). Fortunately, WordPress makes it very easy to get information about logged in users. In this article, we will show you how to retrieve information related to the currently logged in user. We will use the get_currentuserinfo(); function. This can be used anywhere in the theme (header, footer, sidebar, page template, etc.). In order for it to work, the user must be logged in. So we need to use

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.

In the past, we have shared how to use the PostExpirator plugin to expire posts in WordPress. Well, when creating the activity list website, we found this plugin to be very useful. We can easily delete expired activity lists. Secondly, thanks to this plugin, it is also very easy to sort posts by post expiration date. In this article, we will show you how to sort posts by post expiration date in WordPress. Updated code to reflect changes in the plugin to change the custom field name. Thanks Tajim for letting us know in the comments. In our specific project, we use events as custom post types. Now

One of our users asked other websites how to display the number of queries and page loading time in the footer. You often see this in the footer of your website, and it may display something like: "64 queries in 1.248 seconds". In this article, we will show you how to display the number of queries and page loading time in WordPress. Just paste the following code anywhere you like in the theme file (e.g. footer.php). queriesin

Are you looking for ways to automate your WordPress website and social media accounts? With automation, you will be able to automatically share your WordPress blog posts or updates on Facebook, Twitter, LinkedIn, Instagram and more. In this article, we will show you how to easily automate WordPress and social media using IFTTT, Zapier, and Uncanny Automator. Why Automate WordPress and Social Media? Automate your WordPre
