Proper Fixes

The above issues could be properly fixed with the following steps, respectively:

  1. Adding the_widget and widget_content filters (there is already a widget_title filter). An easier, but less effecive solution would be adding before_content and after_content arguments to the sidebar registration function.
  2. Total rewrite of get_search_form(). It’s a weird way to accomplish a relatively simple task function. I believe this bugs been around since version 3.0 (the trac ticket is nearly 2 years old). I’m sure the problem has at least been patched, it just hasn’t made its way into the core yet.
  3. Creation of a new function, or set of functions. I actually submitted a function I’d been using in my themes to gather all this information in a meaningful way, but I guess I was just reinventing the wheel because someone beat me to the punch… THREE YEARS AGO. Why this great function hasn’t been added to the core for that long is beyond me.

Solutions for the Meantime

If and until these proper fixes are implemented, I have devised a few workaround solutions. This code will reproduce the functionality of the above fixes, but without the ability to rewrite the core, they aren’t nearly as elegant as they could be.

The next three pages in this post are about the problems I just listed in order, if you want to skip to a particular one.

One Thought on “3 WordPress Hacks to Unlock Some Much-Needed Features

  1. Shariq on April 18, 2013 at 12:38 am said:


    Thanks for the great post. However, I am having trouble implementing it.
    I am trying to change the look of my searchform. It basically needs to have two text fields. I want this ti be in form of a plugin, which anyone can activate. SO obviously I do not have any control over searchform.php. This made me look at your code snippet.

    I copied your code as it is and added a filter like:
    However, the code seems to go in an infinite loop. I put an echo statement after lines 11 and 12. The one after 12 never gets printed while the one after line 11 keeps on getting printed continously.

    I tried changing the filter to pass the argument to:
    1. add_filter(‘get_search_form’,shinra_searchform(true),1);
    2. add_filter(‘get_search_form’,shinra_searchform(false),1);
    3. add_filter(‘get_search_form’,shinra_searchform($echo),1);
    But none of these work.

    Can you please help me out.

Leave a Reply

Your email address will not be published. Required fields are marked *

Post Navigation