Create a Custom WordPress Sidebar in 2 Steps

Hello friends,
Today here we will learn to implement a custom sidebar into WordPress. It is very useful for any WordPress developer while he/she is using the plugins. Whenever we have to put any plugin on to the specific position on WordPress page, then we have to make a sidebar for that particular position.

There is a very simple technique to make a custom sidebar in WordPress.

1)  In the first step you will have to register your sidebar in to the function.php file as below:

 register_sidebar( array(
          'name' => __( 'Sidebar Name', 'Current activated theme name' ),
           'id' => 'sidebar-1',
           'before_widget' => '<aside id="%1$s" class="widget %2$s">',
           'after_widget' => "</aside>",
           'before_title' => '<h2 class="widget-title">',
           'after_title' => '</h2>',
) );

In this code you will have to enter your custom sidebar name and the name of the theme which is currently activated.

2) In the second step you have to just put the sidebar code in the specific file for the position where you want to put the widget (plugin).

Suppose that if I want to create a sidebar for the footer position than we have to put this code into the footer.php file as below:

          <!--?php if ( !dynamic_sidebar('sidebar-1') ) { ?-->
                    This Content is Dynamic Sidebar 1
          <!--?php } ?-->

In the above code you have to just pass your sidebar id to put that sidebar on the footer position.

Now you can see the newly created sidebar in to the WordPress admin side in the Appearance->Widget menu. Then you will have to just drag and drop any widget (plugin) to put any widget on that (here on footer) position.

I wish that this technique will help you to make a custom sidebar in WordPress. Enjoy

4 Steps to make a simple WordPress Plugin

Hello friends ,
At present to make a plugin is become a very nice activity in WordPress,because all wordpress developers wants different requirements in their different Projecs.So i will explain you only 4 simple steps to make any plugin in WordPress.

Step 1.Folder Hierarchy :-

  • In the first step you will have to make a folder of your plugin name in the   wordpress -> wp-content -> plugins directory.
  • Now in this folder you are going to put your another folder of your coding files,css,js,images and one new plugin file (your_pluginname.php).
  • Now you have to write all further step’s code in your_pluginname.php named file.

Step 2. Plugin Activation and Deactivation Concept:-

  • In the Plugin File you are going to put your plugin name,your website name,your plugin version and your plugin website name as well as the code of functions like plugin activation,plugin deactivation and its shortcode.
  • In Plugin file first of all we have to put plugin configuration code.
     /*
        Plugin Name: Your Plugin  Name
        Plugin URI: Your Plugin Site (if any)
        Description:Your Plugin working or functionality
        Author: Your Name
        Version: Your Plugin Version
        Author URI: Your Website (if  any)
 */
 
  • Now you can see your plugin (without any functionality) in the Dashboard Panel -> Plugins directory.
  • In the second step you will have to put your functionality in your_pluginname.php file.
  • We have register_activation_hook() function to activate all your functionality of your plugin when plugin is activated.

register_activation_hook(__FILE__.’install’);

  • In this function the second parameter install is the function in which you are going to implement wordpress database table creation query required for your plugin functionality.If your install function is in the same file than you have to write a __FILE__ in first parameter otherwise you have to give a source path of that file.

Function install()
{
Your Database Table Cretion Query
}
  • Now we have another function register_deactivation_hook() which will remove all your functionality. You can also delete any wordpress database table which is not required after deactivate your plugin.

register_deactivation_hook(__FILE__,’uninstall’);

function uninstall()
 {
   Your Database Table Deletion Query
  }

Step 3. ShortCode Creation for your plugin:-

  • Shortcode is the heart concept for any wordpress plugin.It is necessary to make a shortcode for your plugin to put your plugin on any page to display it in GUI.
  •  It is very simple 3-step process to make a shortcode for your plugin.

1)  function shortcode()
{
Your Plugin Functionality Code
}

2)  function register_shortcodes()
 {
     add_shortcode('Your Plugin Shortcode name','shortcode');
 }

3)   add_action('init','register_shortcodes');
  • In the first step shortcode is the function which includes all the coding implementation lines which will run wherever you put the shortcode.
  • In the second step you have to register your shortcode by the register_shortcodes function in which you can keep any name of the shortcode as the first parameter of the add_shortcode function.
  • The third and last step includes the function add_action() which will initializes the action of the register_shortcode function.
  • Now we will see some rules for keeping Shortcode name :-

                                                    1)Names should be all lowercase and use all letters;

                                                    2)Numbers and underscores should work fine too(not dashes)

Step 4.Create an Admin Panel Option  For Your Plugin:-

  • Admin panel is another nice concept for any wordpress plugin.
  • It includes all the customization optins which you will provide for your plugin.
  • It is very simple 3-step process to make a Admin Panel for your plugin.

1)  add_action('admin_menu', 'my_first_admin_menu');

2)  function my_first_admin_menu()
{
add_menu_page('Plugin Admin Options', 'Your Plugin Admin Panel Name', 'manage_options','my first','admin_panel);
}

3)  function admin_panel()
{
Code  For Your Admin Panel Options
}

  •  Now you can see one option is added to your wordpress dashboard admin  panel.
  •  In the first stepthe action is added to the dashboard panel to create a new menu (panel).
  •  In the second option  you have to give any name to your Admin Panel option which will incude in the dashboard panel option of  wordpress.add_menu_page function will create a admin page for your customizing options.
  •  In the third and last step you have to create a function which named as in the last parameter of the function add_menu _page and it will includes the coding impletion lines for customizing the plugin functionalities.

This is the very simple four steps and now  you can create your own plugin .Enjoy..

Hosting Sites or installing WordPress on Your Hosting Account in Godaddy

1. Log in to your Account Manager.

2. From the Products section, click Web Hosting.

3. Next to the hosting account you want to use, click Launch.

4. After Launch, you can see home page of your account including file manager, database, FTP and many other.

So now using File Manager, create or choose an installation directory and you can direct upload all file or wordpress setup files via FTP from your local PC.

OR

On the Hosting Control Center home page, click Install Apps.

Click WordPress.

Click Install Now!.

NOTE: The Install Now! Button displays only when the selected value application is compatible with one of more hosting plans in your account. Godaddy Provide inbuilt such application such wordpress, Joomla, Drupal, Simple Machine, Zencart.

5. Create a database name, username and password, and then click Next.

6. Now your installation process is over, so in browser enter url of your hosting account.

7. Enter the Admin Name, Admin Password, Email and Blog Title for your WordPress installation. Click Finish.

Convert gzinflate code into HTML and customize footer, header of your blogs

I am currently having some problems with a coded wordpress theme footer, header and sidebar.
Sometimes, we are found this type of code in footer.php and header.php files, like

<?php $16C6797214BDD4CC97CFEB8DD47A3="VVNBIEFyZWEgQ29kZXM8L2E+LCBhbmQgPGEgaHJlZj0iaHR0cDovL3d3dy50YWxrcm

V2aWV3cy5jb20vIiB0aXRsZT0iV2Vic2l0ZSBSZXZpZXdzIj5XZWJzaXRlIFJldmlld3M8L2E+Lg0KCQkJPC9wPg0KCQk8L2Rpdj4NCg

k8L2Rpdj4NCjwvZGl2Pg0KPC9ib2R5Pg0KDQo8L2h0bWw+IA0KICAgIA==";echo(base64_decode($QD2816C6797214BDD4CC97CFEB8DD47A3)); ?>

Now, if you customize your footer, there are many ways possible for customization. We know to ways which are very easiest.

 

(1)    First, identify your footer.php code, in which is encrypted. Find Online converter on the internet.
There are so many tools to online converter for encrypted code.

http://base64decode.org/
http://webnet77.com/cgi-bin/helpers/base-64.pl

After converted you code, you put this code in footer.php or header.php and you can customize as per your requirements.

(2)    Second way is very simple for programmer or Developer to customize footer. With using of firebug in Mozilla firefox browser. Nowdays there are in almost firebug in all browsers. So we can easily customize it. See, under figure.

In above figure, as per HTML code we can copy and replace with gzinflate code or other encrypted code. Now we can customize footer as per requirements, put our owns links and logos and copy-rights. For better results check HTML code from header.php to footer.php and put closing </div> tags which early started in header.php file.

Now, we can customize our blogs footer as well as header.

Moving WordPress site from one server to Another Server

Step 1. Downloading Files:

Start by downloading your wordpress site folder from your already existing development  server.
Anything you have put into the local PC drive via FTP server or your server Cpanel.

Step 2. Exporting the Database:

In the hosting control panel for your existing build, you’ll need to get all of the data you’ve put into the system out. Using Tools > Export in WordPress is helpful but to ensure you get everything from the existing database, you should really use PHP MyAdmin and export all of the database tables.

Launch PHP MyAdmin, Log In using the existing database credentials, select the database you want to export from the left, then click the Export Tab. Select the Save Without Compression checkbox and you’ve got a backup on your desktop or local drive.

Step 3. Creating the New Database:

In the environment, Now you’ll need a new database. You will have both the Control Panel and FTP Details.  If you can’t get Control Panel access, have the client create a Database for you and have them list the Database Name, Username, Password and Host Name. That and FTP will do the trick – but the client may have to import the database for you. Configure the wp-config.php file for your new site/database and continue to Step 4.

Step 4. Uploading

Backup the client’s existing website first. Then upload all of the appropriate wordpress folders to their host. At this point, you may want to delete the files in the root of their site and replace them with the wordpress root files to make the transition complete. Remember to update the wp-config.php first to be sure it will connect with the new database.

Changes in config.php file.

1)     Define new site URL . (see below figure)

2)     Database name

3)     Database user name

4)     User password

5)     Host server name

Using a web browser, navigate the website and type /wp-admin/ after the url. Hopefully you encounter the WordPress screen where you can name your site, sign in for the first time and see the system working correctly.

It’s a really good idea at this point to go to Settings > General and make sure the URL is pointing to the correct address of the live website.

 

Step 5. Importing the Data into the New Database:

Now you’ll want to get the data you have entered into the development site into the live site. This step is very similar to Step 2 – only the reverse. Log into PHP MyAdmin in the new hosting environment and click Import. Select the file from your desktop and you should have a working copy of the development site.

Step 6. Fixing some errors

Sometimes during transitions you will encounter problems where the live site is looking for file uploads that reference the old development URL address. The easiest way we have found to fix these problems is to install the Search and Replace through plugins and find the old URL and replace it with the new URL.

Hope this was helpful.

 

WordPress LightBox passing Get Variable Problem Solution

On 6th january i have got an Error in WordPress LightBox Plugin to pass GET Variable

I found the solution by Javascript

Here is code for that

1.This is my Scirpt put in Additional script in wordpress but you can also put in .js file anywhere on any php file


<script language="javascript">

function getVaribaleConcate(){

//these are the form object which i want to pass in get variable

var j = document.getElementById("eml").value;
 var s =  document.getElementById("ticket").value;
 document.getElementById("pad").href = "viewstatus.php?m=" + j;
 document.getElementById("pad").href += "&t=" + s;
 }
 </script>

You can Also put any no of variable in above code

Example


document.getElementById("pad").href += "&t=" + s;

this is the final string which assign to href of anchor tag

2.Now Call this from any Link Click Or From any Event And Call LightBox


&nbsp;

<a href=”Example.php?” onclick=” getVaribaleConcate()” rel=”LighBox”>Click Here</a>

Here LightBox Indicating the Code for Your LighBox Installplugin which is inbuilt in wordpress

href=example.php?  indicating  HyperReference File where we want to Submit our data

Onclick getVaribaleConcate() Use to concate The get Varible in url

3.The Example.php where the lightbox is calling and GetVariable is Display in that file


<?php

if(isset($_GET['m']) && isset($_GET['t']) && $_GET['m'] != '' && $_GET['t'] != '')

{

$email = $_GET['m'];

$ticket = $_GET['t'];

echo  $email . “<br/>”;

echo $ticket;

}

?>

I hope this code may be help u

🙂