Sometimes we may need to add custom fields to existing core WordPress REST API, which we may also need in the wp.data module for Custom Gutenberg Block development.In this blog we will learn about how to do just that. Add custom field to ‘user’ endpoint. We will use register_rest_field function and hook it to rest_api_init
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
In this blog, I will explain to you how to set up Webpack for your project. If you want to learn the basics of Webpack and why do we use it, you can watch the video below and then come back. You may already know that Webpack bundles all of your modules and dependencies into
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
Creating a simple pagination for custom post types
date($format, $timestamp) is one of the most commonly used date and time functions available in PHP. It takes the desired output format for the
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
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.