PHP Coding Standardization

PHP Coding Standardization

In WordPress some part of the codes are inconsistent in their style.For that word press is working gradually to make the code clean and easy to read at a glance and all the user can be benefitted by the consistent style.

We should keep the following points in mind while writing PHP code for wordpress,whether for core programming code,plugins,or themes.

Single and double quotes

We must use the single and double quote wherever it is applicable.For the evaluation of any  variables we use double quote otherwise we use single.But never forget to use quote for the string data type.



echo ‘<a href=”/static/link” title=”Yeah yeah!”>Link name</a>’;

echo “<a href=’$link’ title=’$linktitle’>$linkname</a>”;


We must use indentation inside our code so that our code can be easily traced in case of errors.We must use tab not spaces.

Above one can be done as

Brace Style

We must uses braces for all blocks in accordance with the suitable styles:

Use of elseif not else if

As else if is not compatible wih the colon syantax of if|elseif blocks.So we must use elseif for conditionals.

Regular Expressions

We must use the _preg functions in order to do regular expressions related work.Its most convinent to use single-quoted strings for regular expressions since, contrary to double –quoted strings,as they have only two metasequences: \’ and \\.

Opening and closing PHP tags

While coding php within or on the same page with HTML we must be careful about opening and closing tags of php.

No Shorthand PHP tags

We should never use shorthand php tags.We must use full php code.


Remove trailing spaces

We must remove trailing whitespace at the end of each line of code.It is preferred to omit the closing PHP tag at the end of a file.If we use the tag we must make sure of removing trailing whitespace.

Space Usage

We must use spaces after every comma and at both side of logical , comparision ,string and assignment operators.

Formatting sql statements

While formatting sql statements we must break the code into several lines and identations must be properly followed.The sql parts like UPDATE CREATE must always be capitalized.

Database Queries

We must avoid touching the database directly.Using database abstraction rather than queries helps to make our code forward – compatible.If we must touch the database , first get in touch with some developers by posting them message to the wp-hackers mailing list.

Naming Conventions

We must use lowercase letters in variable , action/filter and function names (never camelCase).We must separate words via underscores(let the code be unambigious and self-documenting).

Ternary Operator

We must use ternary operator  if the statement is true not false.

Clever Codes

We must write the codes more readable than focusing on its clevarity.

This much for today.I think You are benefitted by this file.

Thank You!!

Getting Started with BootStrap 4


Download Bootstrap to get the compiled CSS and JavaScript, source code, or include it with your favorite package managers like npm, RubyGems, and more.

Compiled CSS and JS

Download ready-to-use compiled code for Bootstrap v4.0.0 to easily drop into your project, which includes:

  • Compiled and minified CSS bundles (see CSS files comparison)
  • Compiled and minified JavaScript plugins

This doesn’t include documentation, source files, or any optional JavaScript dependencies (jQuery and Popper.js).


Source files

Compile Bootstrap with your own asset pipeline by downloading our source Sass, JavaScript, and documentation files. This option requires some additional tooling:

  • Sass compiler (Libsass or Ruby Sass is supported) for compiling your CSS.
  • Autoprefixer for CSS vendor prefixing

Should you require build tools, they are included for developing Bootstrap and its docs, but they’re likely unsuitable for your own purposes.

Download source


Skip the download with BootstrapCDN to deliver cached version of Bootstrap’s compiled CSS and JS to your project.

<link rel="stylesheet" href="" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

If you’re using our compiled JavaScript, don’t forget to include CDN versions of jQuery and Popper.js before it.

<script src="" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
Package managers

Pull in Bootstrap’s source files into nearly any project with some of the most popular package managers. No matter the package manager, Bootstrap will require a Sass compiler and Autoprefixer for a setup that matches our official compiled versions.


Install Bootstrap in your Node.js powered apps with the npm package:

npm install bootstrap

require('bootstrap') will load all of Bootstrap’s jQuery plugins onto the jQuery object. The bootstrap module itself does not export anything. You can manually load Bootstrap’s jQuery plugins individually by loading the /js/*.js files under the package’s top-level directory.

Bootstrap’s package.json contains some additional metadata under the following keys:

  • sass – path to Bootstrap’s main Sass source file
  • style – path to Bootstrap’s non-minified CSS that’s been precompiled using the default settings (no customization)

Install Bootstrap in your Ruby apps using Bundler (recommended) and RubyGems by adding the following line to your Gemfile:

gem 'bootstrap', '~> 4.0.0'

Alternatively, if you’re not using Bundler, you can install the gem by running this command:

gem install bootstrap -v 4.0.0

See the gem’s README for further details.


You can also install and manage Bootstrap’s Sass and JavaScript using Composer:

composer require twbs/bootstrap:4.0.0

If you develop in .NET, you can also install and manage Bootstrap’s CSS or Sass and JavaScript using NuGet:

Install-Package bootstrap
Install-Package bootstrap.sass