Common functions in WordPress Theme and Plugin development

WordPress Functions of theme and plugin

While working with WordPress theme, we need some common WordPress Functions. Sometime we forget these regular functions, hooks. I am trying to keep a simple note for these functions.

 

 

The file will be updated when needed.

 

Reference Link: https://codex.wordpress.org/Function_Reference

 

 

Auto closing PHP tag snippet for Visual Studio Code

HTML Snippet for PHP tag

While working with PHP and HTML codes, we need to write PHP tag (<?php ?>) several times. It wastes our time. We often feel boring too. As Emmet in Visual Studio Code has no shortcut system to append PHP opening and closing tag, we need to create a snippet so that we can add it quickly.

Step 1:

Go to ‘File Preferences User Snippets

 

Step 2:

Choose ‘html(HTML)‘ here. We are going to create an HTML snippet.

 

Step 3:

Write the below code in ‘html.json‘ file.

Code:

 

HTML snippet does not support in exact inside of Quotation mark. To enable it, we need to do following steps.

Step 4:

Go to ‘FilePreferencesSettings

 

Step 5:

Write the below code in ‘settings.json‘ file.

Code:

 

Hurrah! We have done. Now, we are going to check it.

To check,

  • Open a PHP or HTML file in VSCode;
  • Type only ‘php‘, an abbreviation suggestion will appear;
  • Then, press TAB or ENTER button to insert a PHP block;

 

NOTE: Don’t forget to save changes where needed.

 

By following this steps, we can create our custom snippet easily.