Site icon Thetechhacker

Remote DBA Experts List The Must Know Skills For WordPress Developer

Remote DBA Experts List The Must Know Skills For WordPress Developer

WordPress as we know it is one of the most efficient powerful and popular CMS frameworks being used in the industry at this very moment. It is used in the creation websites that are extremely flexible, complex and expandable in nature. Some believe that the availability of varied plugins and themes for WordPress makes it such an effective tool for developers. We asked the best remote DBA experts to list out a few must know skills for all the WordPress developers out there. Here is what they think is essential for all of you.

According to best remote DBA experts, it’s always beneficial to create your plugins. It not only gives you a better platform but also it will enable you to take your website to exactly where you intended it to be. Better flexibility means better accuracy and in turn better efficiency.

Creating your own plugin

To begin creating your own plugins you need first to create a folder dedicated to plugins in /wp-content/plugins destination. Naming your plugins should have a consistent nomenclature. Plugins name should be easy to understand and differentiate.

<?php
/* Plugin Name:  Sample Name
Plugin URI: http://www.sitepoint.com/tutorials/wordpress-plugin-url
Description: Get email notifications when your favorite author publishes a post.
Version: 1.0
License: GPL2
*/

Your plugin should be visible on the dashboard

Activating/deactivating your plugin

Register_activation_hook function will be triggered by activation of your plugin. A custom function can also be used for activation.

function wp_sample_activation() { } register_activation_hook(__FILE__, ‘wp_sample_activation’);

The file of the path that contains the activation function should be the first parameter and the function name can be taken as the other parameter

A similar course is followed for deactivating the plugin.

function wp_sample_deactivation() {  }  register_deactivation_hook(__FILE__, 'wp_sample_deactivation');

Custom table creation

The WordPress database table is extremely flexible and in most of the situations, you should be able to make use of the tables provided in the WordPress functionality.

But for additional functions, you may need to know how to create the custom tables.

global $wpdb; $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}sample_table"); 
$sql1 = "CREATE TABLE {$wpdb->prefix}sample_table ( id int(11) NOT NULL AUTO_INCREMENT,                                                        
activation_code varchar(255) NOT NULL,                                                        
email varchar(75) NOT NULL,                                                        
status int(11) NOT NULL, PRIMARY KEY  (id) )          ENGINE=InnoDB AUTO_INCREMENT=1;";  
require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql1);

It’s important to ensure if the table that you require is not already available. If your table is not included by default, you need to include the file first.

Including scripts and styles

One way of going about this is to just echo the scripts and styles from and to anywhere. But if you are creating your own styles then it is recommended to check once if the file is already present anywhere else. And also the dependencies of the same.

add_action('wp_enqueue_scripts', 'sample_scripts');
function sample_scripts() 
{
wp_enqueue_script('jquery');
wp_register_style('sample_style', plugins_url('styles.css', __FILE__)); 
wp_enqueue_style('sample_style');
wp_register_script('jqueryUICore', plugins_url('ui/jquery.ui.core.js', __FILE__),array(“jQuery”));
wp_enqueue_script('jqueryUICore');
$config_array = array(“sample_name”=>”sample_value”]);
wp_localize_script('jqueryUICore', 'sampleData', $config_array);
}

Adding option boxes

WordPress provides a few default set of boxes, fields, title etc in the content creation screen. But you may require custom fields to add additional behavior. And custom fields section only provides boxes. It’s very easy to use option boxes to provide additional fields.

add_action('add_meta_boxes', 'add_custom_fields_box'); function add_custom_fields_box() {

add_meta_box(‘custom_fields_box_id’, ‘Custom Info’, ‘display_custom_info_box’, ‘post’, ‘normal’, ‘high’); }  function display_custom_info_box() { global $post; $html = “<table><tr><td>Custom Checkbox</td><td><input id=’custom_checkbox’ type=’checkbox’ name=’custom_checkbox’  /></td></tr> <tr><td>Custom Selecy</td><td><select name=’custom_select’  > <option>Option 1</option> </select></td></tr> <tr><td>Custom Upload</td><td><input id=’custom_file’ type=’file’ name=’custom_file’  /></td></tr></table>”;  echo $html;  }

 

Exit mobile version