Plugin Development Strategies and Maintenance

Strategies:

Strategies are the steps which we follow during the plugin development process. Below are some of the steps to be undertaken so that the process becomes more effective as well as faster.

Planning

Planning is the blue-print of a process. Before we directly go to the development of a plugin, we plan the road-map as well as the strategies we will be following. It includes all the processes from naming of the plugin to

Continue Reading
How to Use Ajax in WordPress

How to Use Ajax in WordPress

Ajax is already built into the core WordPress administration screens, adding more administration-side Ajax functionality to the plugin is fairly straightforward.

Example

Below is a simple example where a post id is sent via ajax and is used by a main handler function (here storing a post id in session) whenever a button(link) is clicked.

So, here is a link:

<a class=”order” data-nonce=”‘ . $nonce . ‘” data-post_id=”‘ . $post->ID . ‘” href=”javascript:void(0);”>Order</a> Function

The

Continue Reading

Creating and Using Child Theme in WordPress

# What is Child Theme

According to wordpress.org, “a child theme is a theme that inherits the functionality and styling of the parent theme”. Just like parent classes are inherited by child classes to use the properties of parents, child themes does the same. Child themes are the recommended way of modifying an existing theme.

# Why to Use Child Themes

As mentioned child themes are always handy when it comes to customization of any

Continue Reading

Using PHP variables with CSS

Approach can be different but I find this an easy approach to use. Below example shows the use of PHP variables in CSS in a WordPress plugin.

First, create a php file: dynamic.php (say). There just put the css codes where css properties are passed via php variables:

<style> <?php $wss_color = get_option(‘ws_slider_settings’);

$caption_color = esc_attr($wss_color[‘caption-color’]); $desc_color = esc_attr($wss_color[‘desc-color’]); $shadow_color = esc_attr($wss_color[‘shadow-color’]);

if($wss_color[‘caption-color’]!==”){ ?> .wss-caption p{ color: <?php echo $desc_color ?>; opacity: 1; } <?php

Continue Reading

Properly Enqueuing Styles, Scripts, Fonts & Conditional styles

It is always a good option to enqueue your stylesheets & scripts in the functions. Generally, we enqueue our styles & scripts in ‘functions.php’.

Enqueuing styles

The basic function for enqueuing a style is:

wp_enqueue_style( $handle, $src, $deps, $ver, $media );

You can include these parameters:

$handle is simply the name of the stylesheet. $src is where it is located. The rest of the parameters are optional. $deps refers to whether or not this stylesheet is dependent on

Continue Reading