Lesson 2. Developing a Shortcode for the WP Post Autocomplete Plugin
Lesson 2. Developing a Shortcode for the WP Post Autocomplete Plugin

Let’s continue developing our WP plugin for post autocomplete. Today, we will create a shortcode with an input field for the search query.

Generally speaking, there are two approaches to structuring plugin code:

  1. Use standalone functions to define hooks, filters, helpers, etc. In this case, it’s best to prefix each function name to avoid conflicts with other plugins/themes or WordPress core functions.
  2. Use class-based development. Here, you still need to use prefixes, but far fewer, since most logic is encapsulated in class methods.

read more...

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...