making a plugin that moves other plugins wp_head actions to wp_footer

Remove the action, then add it back on a different hook. I think the only concern you could have with doing this is ensuring you do that late enough for the action to have been hooked, it should possible using the plugins_loaded hook(because that runs after plugins have loaded). add_action( ‘plugins_loaded’, ‘juggle_sharethis_action’ ); function juggle_sharethis_action() … Read more

adding a button to the media uploader

When i needed to do something similar i used the admin_print_scripts-media-upload-popup hook to add my own js/Jquery code to insert a button and handled it’s click event with ajax. something like this: add_action(‘admin_print_scripts-media-upload-popup’,’add_my_media_button’); function add_my_media_button(){ ?> <script> jQuery(document).ready(function() { //loop over all attachments jQuery(“.savesend”).each(function(i,v){ if (jQuery(this).next().attr(‘id’) != “”){ //get attachment id var att_id = jQuery(this).next().attr(‘id’); … Read more

Quasi-custom API Call Plugin

You might not need a plugin for this. You can do it this way. Say you are fetching data from WP1 to WP2 instances. create a page in WP1.. say “Custom API” with url /custom-api/. create a template in WP1 named “custom api” in WP1 assign page “Custom API” to template “custom api”. Since your … Read more

Meta box on options page save form problem

It’s not enough to define areas and put metaboxes in them, you must define the layout via the current screen. For example, when displaying a dashboard esque widget area on my custom option page, the first things I have are: global $screen_layout_columns; add_screen_option(‘layout_columns’, array(‘max’ => 3, ‘default’ => 3) ); $screen = get_current_screen(); wp_enqueue_script( ‘dashboard’ … Read more

Plugin development – loading Javascript and Flash

you should use wp_print_scripts hook for your scripts instead of init and in your callback make sure that you are not in the administration pages something like this: add_action(‘wp_print_scripts’,’register_libraries’); function register_libraries(){ if (!is_admin()){ //enqueue your scripts here } } as for adding flash, that should be a separate question just make sure to add more … Read more

unable to wp_enqueue_script(‘suggest’);

As stated on WP Devel, you should always use the appropriate hooks. Else no child theme could deregister the script later. // In your functions.php file function add_suggest_script() { wp_enqueue_script( ‘suggest’, get_bloginfo(‘wpurl’).’/wp-includes/js/jquery/suggest.js’, array(), ”, true ); } add_action( ‘wp_enqueue_scripts’, ‘add_suggest_script’ ); This will load the script from the includes folder and stick in your footer … Read more