Plugins

Lesson 1. How to write a WordPress plugin yourself.
Lesson 1. How to write a WordPress plugin yourself.

With this post, I’m starting a series of complementary articles dedicated to developing plugins for WordPress. The goal of our plugin will be to implement AJAX-based post search with autocomplete. To achieve this functionality, we’ll need to cover several topics, including:

  1. Plugin file creation
  2. Shortcode development
  3. Connecting styles and scripts
  4. Working with AJAX in WordPress
  5. Using jQuery Autocomplete
  6. Displaying post lists on the page and adding pagination

As you can see, there’s a lot of work ahead. For those just starting out with WordPress development, this should be especially useful.

read more...

How to Make Simple Tabs with a jQuery Plugin
How to Make Simple Tabs with a jQuery Plugin

This article is a continuation of the post about tabs using jQuery and flexbox. Today, we will modify our script and implement it as a jQuery plugin with some improvements.

First, we will split the script logic into two files:

  1. Styles. These will remain unchanged, just moved from the HTML document into the file “jquery.tab-light.css”.
  2. JavaScript. The script will be moved into the file “jquery.tab-light.js”.

Also, don’t forget to include the above files in your HTML document.

Second, we will name our plugin “tabLight” (i.e., simple). This name will be used in our JS code.

read more...

How to enable caching of adsense ads from google in wp-rocket
How to enable caching of adsense ads from google in wp-rocket

WP Rocket is one of the most popular caching plugins for WordPress, offering a rich set of features and flexibility.

WP Rocket has the ability to combine and minify JavaScript and CSS, generating a separate file for each. Additionally, it collects all inline JS/CSS from the site's HTML code and adds it to the aggregated cached files. This is certainly convenient, but in some cases — especially when used alongside other plugins — it can lead to errors or improper behavior.

read more...

How to programmatically change the name and description of a site in Yoast SEO
How to programmatically change the name and description of a site in Yoast SEO

The Yoast SEO plugin for WordPress provides a solid set of hooks that allow you to flexibly manipulate data when building your own meta tags.

In this article, we’ll look at an example where you need to change the site’s title and meta-description for a specific page. The example is simple and is intended to demonstrate how the hooks work. The logic can be customized however you like. For instance, in one of my projects, I had to dynamically generate titles and descriptions depending on the selected region and the services provided. It was a services directory broken down by country, region, city, and category list.

read more...

How to Disable Pagination in Category and Tag Canonical Links in Yoast SEO
How to Disable Pagination in Category and Tag Canonical Links in Yoast SEO

There’s a great plugin called Yoast SEO by Yoast available in the WordPress repository. It includes a wide range of features that meet the needs of most beginner — and even advanced — SEO specialists.

However, this post is not about its feature set or advantages over other similar plugins. Instead, we’ll focus on pagination in canonical URLs for tags and categories.

read more...