Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am grappling with implimenting jQm on wordpress and have hit the obstacle that most plugins dont work on jQm ajax loaded pages.

However, taking the example of the sharethis plugin, I have found that it will run on the ajax loaded page if I change this

add_action('wp_head', 'st_widget_head');

to this

add_action('wp_footer', 'st_widget_head');

in the sharethis.php file

The thing is that I want to try and do this leaving the initial plugin files untouched (so that wp updates will work and so that I can keep all my jQm specific plugin modification changes in one place- so they can all be turned off if jQm is turned off)

So I think what I n eed to make to begin with is a plugin that loads last, that moves any plugins I specify to move their add_action wp_head to add_action wp_footer.

I appreciate this is currently a very brute force solution, but so far this is the only chink of light I have found in what seems to be an impenetrable situation, which otherwise requires re-writing all the plugins I use to work with jQm.

So any ideas on this would be very helpful in helping me create a more solid and maintainable solution to this, something like a 'jQm plugin fixer plugin' that I and the community could develop and maintain...

share|improve this question

1 Answer 1

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() {
    remove_action( 'wp_head', 'st_widget_head' );
    add_action( 'wp_footer', 'st_widget_head' );
}

Actions
http://codex.wordpress.org/Plugin_API/Action_Reference

Adding actions
http://codex.wordpress.org/Function_Reference/add_action

Removing actions
http://codex.wordpress.org/Function_Reference/remove_action

share|improve this answer
    
Fantastic, I'll try that. Thanks so much for your quick response and the extra info. I'll keep this updated with my progress... –  David O'Sullivan Dec 2 '11 at 13:01
    
You're welcome, let me know how you get on. –  t31os Dec 2 '11 at 13:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.