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 currently have the following plugins activated in my wordpress installation:

row 1:

Outbrain

row 2:

Subscribe via feedburner RSS/email

row 3:

Topsy tweet widget, FB like widget, WP-Email a friend widget

I want to change the order in which they appear.

I want widgets in row 3 to appear first, outbrain widget to appear last, in row 3. How do i achieve this?

Although I can fiddle a little bit with PHP if the solution requires, I prefer an independent plugin to take care of the ordering if there exists one!

Thanks!

share|improve this question
3  
Priorities of the plugged filter, I guess. –  Ashfame Apr 13 '11 at 7:20
    
I know this may be the obvious but are you using [Shorttags] or <?php $template_tags ?> if so reorder them in your template/post. If not see @Ashfame's answer. –  BandonRandon Apr 13 '11 at 10:01
    
Thanks Ashfame, was able to rearrange the plugins by passing priority as 3rd parameter to add_filter, within these plugins. Forked for all, except WP-Email, which wouldn't budge from the last position :( But this is not the right way I guess, since the next plugin update will erase my local changes.... –  Ashwin Prabhu Apr 13 '11 at 10:33
    
@BandonRandon, not aware of [Shorttags]. I don't dabble with wordpress a lot, hence my technical knowledge of wordpress code is only so-so –  Ashwin Prabhu Apr 13 '11 at 10:35

1 Answer 1

up vote 4 down vote accepted

From your comment it looks like you almost got it,

Plugins that add something under your content usually use the_content filter by calling a function using add_filter for example outbarin plugin calls it like this:

add_filter('the_content', 'outbrain_display');

so the way your can order them is by passing the priority parameter

add_filter('the_content', 'outbrain_display',99); 

But changing it directly on the plugin's files is not the right way since next time you will update the plugin you will lose these changes, so the right way to do it is to add an action after the plugins were loaded using the plugins_loaded action hook and remove the filters they added and then re add this filters using your desired order:

add_action('plugins_loaded','my_content_filters_order');
function my_content_filters_order(){
    //first remove the filter call of the plugin
    remove_filter('the_content', 'outbrain_display');
    //... Do that for all filters you want to reorder
    //... ex: remove_filter('the_content', 'FB_like');

    //then add your own with priority parameter
    add_filter('the_content', 'outbrain_display',99);
    //... Do that for all filters just removed and set
    //... the priority accordingly 
    //...  Lower numbers correspond with earlier execution
    //... ex: add_filter('the_content', 'FB_like',98);
    //... this will run first then outbrain
}

hope this helps

share|improve this answer
    
Thanks! Your reply is very informative! –  Ashwin Prabhu Apr 14 '11 at 5:59

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.