Setup Tailwind CSS in a WordPress plugin or theme

Setup Tailwind CSS in a WordPress plugin or theme

Posted on

In this blog we will discuss how we will setup Tailwind css in a WordPress plugin or theme. Tailwind CSS is a highly customizable, low-level CSS framework that gives you all of the building blocks you need to build bespoke designs without any annoying opinionated styles you have to fight to override. Lets setup webpack

Read More

Internationalization and Localization in WordPress

Internationalization and Localization in WordPress

Posted on

Internationalization is the process of developing your theme, so it can easily be translated into other languages. Internationalization is often abbreviated as i18n (because there are 18 letters between the letters i and n). Localization describes the subsequent process of translating an internationalized theme. Localization is abbreviated as l10n (because there are 10 letters between the l and the

Read More

Lazy Loading Images in WordPress

Posted on

In this blog, I am going tell you the quickest and easiest way to create lazy loading without using any libraries.We are just going to use simpleCSS and JavaScript The Concept We first add the lightweight image URL in the src and srset attributes, and the actual image URL and actual srcset into data-src and data-srcset respectively.On initial page load, on window resize, scroll and

Read More

Using Templates in WordPress

Using Templates in WordPress

Posted on

In themes: get_template_part( ‘slug-name’, ‘name’ );We should keep our templates inside template-parts directory.So lets say our template file is in: themes/theme-name/template-parts/home/home-my-template.phpTo include this template you will write ( for e.g. inside front-page.php ) For e.g. our template file is in: themes/theme-name/template-parts/home/my-template.php In Plugin, For e.g. our template file is in:plugins/plugin-name/templates/my-template.php If we want to pass

Read More

Fix PHPCS errors in WordPress

Fix PHPCS errors in WordPress

Posted on

Visibility must be declared on method “__construct” Add public before the class method Detected usage of a non-sanitized input variable: $_POST[‘xyz’] You need to sanitize it. E.g. esc_html( $_POST[‘xyz’] ) or sanitize_text_field( $_POST[‘xyz’] )  Detected usage of a possibly undefined superglobal array index: $_POST[‘query’]. Use isset() or empty() to check Wrap it inside empty() e.g.

Read More