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.

How to arrange the order of plugins displaying under every post? I got some plugins which display information, social media sharing, etc under every post. How can I arrange the display order?

share|improve this question
add comment

1 Answer

Two possibilities: 1) some funky css - could be tricky to float/move things around though

2) some php (no plugin code changes) as follows:

The wordpress filters and action hooks have a priority that the plugin developer can assign EG: see http://codex.wordpress.org/Function_Reference/add_filter

This determines the order in which the filters will be applied. I think very carefully about this when i write plugins as one can consider whether one's function should run early or late. EG: to make functions 'pluggable' I have their code included late in a 'plugins_loaded' action if the functions are not already defined. that way anyone else can jump in and define their own function.

Basically By changing the priority of the filters in the add_filter call in the plugin code, one can alter the sequence that they for example add stuff to the content. EG: if lots of plugins are adding stuff to the end of the content, then one that has a high priority number will run later and get to really add things 'last' to the end of the content.

If plugin authors have used the same priority number, then maybe the sequence of activation will come into play.

SO HOW TO CONTROL???

well what you could maybe do (if you have some php knowledge), is write your own little site-specific snippets plugin see otto's post on how to do this

In an appropriate action hook (maybe on 'plugins_loaded' with a very late priority ? so as to be sure to run after all the other plugins), add remove_filter calls for all the filters affecting your content (matching the plugins add calls) THEN re add the add_filter calls back, exactly as they are in the plugins code, but this time changing the priority to suit yourself.

This way you have made no changes to the plugin code, they are all still upgradeable (so long as they do not change their code) and you can control their order. I have been having fun recently writing an override for subscribe2 doing a similar thing on the cron jobs - very empowering, since one avoids changing the plugin and one stays in the upgrade path! The more I work out what one can all do in WordPress, the more I love it!

share|improve this answer
add comment

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.