PHP designers will make a whole class framework so as to maintain a strategic distance from impacts with capacities and variable names. In the event that you are new to the progressed OOP usefulness of PHP then it’s best to simply compose your code in test capacities.

So for our sample code we will compose a solitary capacity to house our information. We likewise need to characterize a couple of variables which are vital to actualize inside our format documents. The following is a case bit of code taken from our module document with the center rationale evacuated.

At the point when composing your example code it’s best to take after regulations and aides set up by WordPress. Since there are such a variety of interior capacities effectively characterized you can dodge copies by prefixing a name to every one of your variables and capacity names.

<?php

define(‘Webetutorial_FOLDER’, dirname(plugin_basename(__FILE__)));

define(‘Webetutorial_URL’, $siteurl.’/wp-content/plugins/’ . Webetutorial_FOLDER);

define(‘Webetutorial_FILE_PATH’, dirname(__FILE__));

define(‘Webetutorial_DIR_NAME’, basename(Webetutorial_FILE_PATH));

define(‘Webetutorial_DEFINE_DIRECTORY’,WP_PLUGIN_DIR.’/visit-counter/’);

// this is the table prefix

define(‘Webetutorial_SITE_URL’,$siteurl);

global $wpdb;

global $siteurl;

$Webetutorial_prefix=$wpdb->prefix.’Webetutorial_’;

define(‘Webetutorial_TABLE_PREFIX’, $Webetutorial_prefix);

?>


0 thoughts on “WP Naming Conventions”

Leave a Reply

Related Article

Blog

How to add user profile image by custom URL and custom fields in woocommerce

If you want to add user profile image by custom URL and add custom fields of profile image like first name, last name in your woo-commerce registration form then see our code below, you can Read more…

Blog

WordPress Create Own Forget Password Page

WordPress Custom Forgot Password Page, we need to use the same page for forgot password as well. Here is the jquery function and also we are going to give id to play with both forms. Read more…

Blog

Best WordPress Navigation Menus

Is it accurate to say that you are searching for the best instructional exercises to work with WordPress route menus? WordPress route menus permit you to effortlessly tweak and oversee menus on your site. In Read more…