Extend WordPress ? plugin’s addiction or theme’s functions, that is the question !

Want new features in WordPress: what to choose? an extension or a function in the theme functions.php ?

To begin to find solutions to this question, to collect some properties, I propose a series of questions

WP plugin Directory

WP plugin Directory

– Does the functionality sought only to the site, the organization of his data (data-design) and presentation (the theme, design, ergonomics)?

– Are the tools will be reusable on other sites and do their settings require the use of the interface of the dashboard by the webmaster and editor of the site (CMS) or blog?

– Are the desired features usually for the whole site or will they be allocated to the publication of each post?

– The features they cover one or more files of the theme index.php, page.php, category.php … ?

– What is the level of settings of tools ?a webmaster or as skilled publisher knowing WordPress or with a good knowledge of html and php?

Will functions use objects and modules in the core of WordPress? Also, ‘hook’, action and filter as well as’ shortcode ‘will be necessary?

Four years of using WordPress, the search for information – documentation, extensions available, tracking updates (referred to debug or upgrading), we have begun to define a first approach :

Some goals:

– Php code as short as possible.

– As much as possible: an exceptional use of javascript but can be challenged with frameworks such as jQuery or mootools.

– Keep in touch the developer of the plugin (by email or forum). Nothing worse than a tool without after-sales service especially when the update of WordPress occur.

– Limit the insertions in the header (script, css) of html page: only affected pages in order to limit potential interactions.

A few rules:

Functions file in theme's folder

Functions file in theme's folder

The functions that relate only to the site (CMS or Blog) are installed in fonctions.php theme developed for this site. Example: a ‘shortcode’ to make a specific layout for the authors of the site – combining, for example, text indent and insertion of an icon.

Another example: a function that determines whether an post should be displayed or not according to its category and the user’s rights (logged or not). This site has public and private areas.

The implementation of plugin to select themes (xilitheme-select) was imposed because its main function – to select the theme based on the browser (on a desktop computer or iPod / iPhone) – is independent of the themes that are in the selection. The plugin also gives other information which is used in functions and elements of the theme.

A combined approach: xili-language
This plugin changes the language of the theme’s terms according the language of the post or the displayed category. Plugin also offers « hooks » that allow the designer-webmaster of the site to add specific functions (with specific rules) to the theme (via the file functions.php).
It is possible to customize the theme in the display of the list of available languages or set of restrictive rules to changing language of the context depending on the type of posts. It is a good way to complete the approach CMS separating datas from their presentation (look).

The debate is open, use the comments or the contact page.

M

Ce contenu a été publié dans Studies. Vous pouvez le mettre en favoris avec ce permalien.

Laisser un commentaire