WordPress.org

Ready to get started?Download WordPress

Forums

[RFE] Crazy Idea For Improving Action API and Overall Theme Usability (1 post)

  1. broofa
    Member
    Posted 5 years ago #

    I love WordPress, but one aspect of it that I find very frustrating is the number of dependencies that exist between themes and plugins. As often as not, plugins require theme code to be edited to provide a necessary action. This is problematic for theme and plugin developers, and for blog administrators. Theme authors have no good way of knowing which of the 1000's of plugins available may or may not work with their theme, plugin developers don't know how many themes their plugin will work on out of the box, and WordPress administrators are caught in the middle having to customize theme files in ways that have nothing to do with, well, the _theme_ of their site. The result is that for all but the most basic WordPress installation, switching themes can be problematic and time consuming.

    For example, this bug took me 2 hours to figure out: http://wordpress.org/support/topic/230142

    Even when a plugin documents the changes needed by a theme, such as with the WP-PostRatings plugin, these changes add up and eventually result make it distressingly difficult to switch to a new theme, or even upgrade the one you already use. This, as much as anything, is why many blogs admins are reluctant to upgrade.

    There are two things that can be done to alleviate this problem.

    First, WordPress should enhance the current set of actions so so that it provides a full suite of _logical_ entry points for plugins. There are some obvious ones missing currently, such as:
    - before_post (called before a blog post is rendered)
    - after_post (called after a blog post is rendered)
    - before_comment_form
    - after_comment_form
    ... and I'm sure a poll of plugin developers would turn up some good suggestions for others.

    Obviously this doesn't completely solve the problem. Many of the new actions will still have to be invoked from with the code supplied by a template. This is where the second suggestion comes in ...

    WordPress should support a "theme validation" feature that allows theme developers to verify that they are making the necessary and expected do_action calls(). In this mode, WordPress would do the following:
    - Insert dummy content (a placeholder div of some sort?) on any action that a plugin may use to insert content into a page. This allows the theme developer to account for as-yet-unknown content.
    - Provide strict checks to insure that the theme is triggering all of the required actions.
    - Append a "theme validation report" to the end of each page request that summarizes clearly to the theme developer what actions they are and are not triggering.

    This approach does not require changing any of the existing themes or plugins - it simply provides theme developers with better information about where their theme may be deficient. The end result will be themes that are provide a more reliable and useful action API for plugin developers which, in turn, will create less work for everyone.

Topic Closed

This topic has been closed to new replies.

About this Topic