Normally in a WordPress blog the webmaster will add author box and social share buttons. There are lot of author box plugin available in internet and also lot of social share plugin too. I am using Fancier Author Box plugin it is a free version for author box and Share this plugin for Social buttons. For getting better result both plugin need customization. When i installed both plugin, the share this plugin comes below the author box. It is not good for my blog so try lot to move the share buttons above the author box. Here i an going to share how to move share buttons above the author box.
How to change plugin position
If you installed two plugins run a filter or action on any given hook Then filter or action will be given a priority for the position of plugin The default is 10 if i remember correctly. Suppose you need to run one filter or action first, then you need do is set a higher priority for the filter or action that should run last, and a lower value to run first.0 is highest priority, 10 default and n (any numeric value) will be the further priority.
add_action( ‘hook_name’, ‘callback_name’, 100 ); here 100 is the n value for priority.
add_filter( ‘hook_name’, ‘callback_name’, 100 ); here 100 is the n value for priority.
Hook name stands for the WordPress action/filter hook name, and the callback name stands for the name of a function being hooked onto the given hook. In some case Some actions or filters will not declare a priority (the third parameter – a numeric value), in which case it is given a default value of 10. An example for fixing priority on action/filter is given below
Suppose there are two plugin Plugin 1 and plugin 2 if you want to move plugin 2 above plugin one First you need to edit the action/filter priority. Open plugin 1 and plugin 2 php file and edits these lines
add_action( ‘the_content’, ‘plugin1_function’ );
add_action( ‘the_content’, ‘plugin2_function’ );
For adding priority
add_action( ‘the_content’, ‘plugin2_function’, 100 );
add_action( ‘the_content’, ‘plugin1_function’, 200 );
Here plugin 2 has priority n value = 100 and plugin 2 has the priority n value 200, i already told that less value has high priority. After giving this values the plugin 2 comes above plugin 1
Before providing priority
After providing priority
The share buttons below the author box. Here i give a priority only for share this button. Because there is no priority assigned before on both plugin. In this case you just want to give priority for one plugin.
How i assigned priority for share this plugin
Step 1 : Log in to WordPress.
Step 2 : Plugin -> edit share this plugin .php file
Step 3 : Search for this line ( add_filter(‘the_content’, ‘st_add_widget’);
Step 4 : Then assign a priority add_filter(‘the_content’, ‘st_add_widget’,0);
Note : I already told you 0 has highest priority so this plugin comes higher position.
Step 5 : Then update file.
Here i just share my experience and knowledge. I am not a heavy developer. This article may help those who like to move the share buttons above the author box.
Latest posts by Maneksh M S (see all)
- How to Setup Google Custom Search on WordPress Blog - July 22, 2013
- How to Use Google Webmasters Associates - July 13, 2013
- Best List of Cheapest Mobile phone that support Whatsapp with Price - July 10, 2013