jQuery Tip Cards – Create A Google Tips Card Animation For Your Website
April 29, 2014
8 Awesome Open Source Dreamweaver Alternatives
May 6, 2014
Show all

How to Object Oriented Programming in WordPress using Control Structures

To begin with the topic, we must have a clear understanding of What are control structures? What are its uses and how can it be helpful in the purpose of executing object oriented programming.

Control Structure performs the basic function of controlling the code flow through the program based on the number of associated factors. For example, if we are to set a certain number of instructions, but if there is only one variable is set or there’s another set of instructions of another variable is set.

Programming in WordPress using Control Structures

Or lets assume for a moment that they are set of data that one is interested in looping through by reading each of its value contained in it, setting aside certain values to the data or even for that matter going ahead and creating those values.

Whatever the situation may be, the way one goes about planning and executing it is through the use of control structure. Control structures are of basically two types

  • Conditional Control Structure
  • Loops Control Structure

Conditional Control Structure have the subsets with – “if/then” statement, “switch/case statement” . These are easy to understand, as they read more like a textual statement . For instance, if you are executing a program with a statement like “if this statement is true,then perform the action, otherwise,do another action”


if( condition ) {

    // Take on action

} else{

    // Take another action


Certainly, the programs gets a little complex than that, but one certainly gets the gist of the statement by following the action statement under the conditional programming structure.

They are many statements that can be written and programming structures can be executed under the “if/then” statements.

The evaluation in “switch/case” statements happen in a different way. The case statements dictate what action is desirable to be taken. After each statement a “break” statement is given to break the action of the sentences during the programming.


switch ( condition ) {

case ‘value’:

// do action


case ‘another value’:

// do a different action



// perform a default action



Loop Statement provides the medium to repeat the command and control how many times they are repeated. C provides a number of looping way.

Example –


$persons_name = ‘Tom’;

$email_address = ”;

switch ( strtolower( $persons_name ) ) {

case ‘tom’:

$email_address = ‘tom@acme-server.com’;


case ‘david’:

$email_address = ‘david@acme-server.com’;



$email_address = NULL;



There are many different examples of looping statements where the “while loop” is used to repeat the statement. Like an If statement, if the test condition is true, then it is immediately executed.

There is ‘for loop’ used mostly for the purpose of process lists such as a large group of numbers. Do..While loop is similar to while loop, however, the basic difference is that the test are conditioned at the end of the program and not in the beginning.

These are the basic information that the programmer should be familiar with before executing the task of using object oriented programming.

How does Object Oriented Programing function with Controlling Structures?

  • These functions are the prerequisite required to fulfill the necessary condition to design an overlay of program in WordPress.
  • These statements are vital to understand to execute any programming and object-oriented programming function which is an approach to designing modular, reusable software system helps In creating a programming statement which is not only easy to understand but has the ease of maintenance and evolution embedded with it.

These are the basic fundamentals of object-oriented programming under control structures. Know it to execute it well for the programs.