At the recent WordCamp Edinburgh, I took part in a panel discussion about WordPress theme development and the options available to developers when building themes. The overriding conclusion from the session was that there isn’t a one-size-fits-all answer and that the best method depends on the needs of the website and the capabilities of the developer.
But if you’re starting out building WordPress themes or want to develop a system for building them more efficiently or robustly, how do you decide which approach to take? In this article, we’ll briefly describe how WordPress themes work and then look at some of the different approaches to developing them, with tips on which approach might be most suitable for your website and circumstances.
In WordPress, themes drive a website and determine what it contains, how it behaves and what it looks like. The theme is separate from the content, which is held in the database. This means you can use the same theme on more than one website, regardless of the content of the websites — which you might already be doing if you’ve downloaded themes from WordPress’ theme repository.
Before deciding which approach to take to develop your theme, identify your constraints. These likely include the following:
We’ll revisit these considerations at the end of the article and identify which development options are most suitable for various situations.
A few options are available for developing your theme or themes, and investigating them before you roll your sleeves up and start coding would be worthwhile. Picking the right approach will result in a better theme, with more robust code, and it will minimize the amount of revisions you’ll have to do later. It will also help you to build the theme more efficiently.
The options we’ll look at here are:
This approach is the most difficult if you’re inexperienced. But if you’re a seasoned WordPress developer, it will give you the most control. It might be the most appropriate method if you’re importing HTML from an existing static website that is being upgraded to WordPress with no other changes.
However, when transferring a website to WordPress, conducting a review of it as part of the process, rather than simply copying the code across, is a good idea. If you are copying a static website, you’ll need to keep a close eye on your code to ensure that it’s clean, efficient and valid.
This is how most people start with WordPress theme development: in working on a theme that they’ve downloaded, they see that some styling isn’t quite right, so they delve into the style sheet and make some edits. Starting like this is tempting because it feels like a quick and easy way to achieve the effect you want. But there are some dangers:
However, hacking a theme can work if you go into it with your eyes open. It may be an option if the following are true:
If you do decide to go down this route, keeping a backup of the original theme and commenting your code thoroughly are important. I would also advise commenting out any code that you don’t want and then testing to see what happens before deleting anything.
The theme customizer was released with WordPress 3.4. It gives you the option to customize a theme without writing any code, simply by using a WYSIWYG interface. Depending on how well the customizer is written into the theme itself, you can use it to change images, titles, colors and even the layout. Expect to see more themes with the customizer integrated into them.
Using the WordPress theme customizer with the Twenty Ten theme.
The theme customizer stores your changes in a separate file, not in the theme’s style sheet, so there will be repetitive code.
For more information, take a look at Otto on WordPress’ video tutorial or guide to integrating the theme customizer into your own themes.
This approach is similar to editing an existing theme, but safer. It consists of creating a brand new theme that is defined as a child of the existing theme. Where your child theme doesn’t have a particular file but the parent theme does, it will use that. Where the child theme does have a file, that file will override the equivalent in the parent. This line tells the browser to load the parent theme’s style sheet before rendering any of the styles in the current style sheet. This frees you from having to duplicate any styles in the parent theme that you want to use.
So, that’s how child themes work. But when is this the best approach? I would suggest using it in the following cases:
from : http://www.smashingmagazine.com/2013/03/13/a-guide-to-wordpress-theme-options/
This Demo Content Brought to you by Momizat Team
Alain Mabanckou : « La durée de vie d’une dictature dépend de l’ampleur de notre silence »
Interview du Général MOKOKO « Rien ne me fera reconnaître une élection que je conteste »
Interview de Fabrice KONDI , PDG de Yanis.K Service
Guy Romain Kinfoussia « Il n’est plus question de dialoguer avec ce pouvoir »
Charles Zacharie Bowao « Je crains que le pouvoir ne soit débordé par une insurrection »
La population de Nyanga boude Destinée Doukaga en visite éclaire
Crimes contre l’humanité de Sassou Nguesso en vidéo: Opération Mouebara
Dolisie : un agent de la S.n.d.e pourchassé par un abonné armé de machette .
Congo Brazzaville : Nomination des nouveaux maires et sous- préfets
Département du Niari : La ville de Divenié est sinistrée
© 2016 Copyright BrazzaNews | Mentions légales | Nous écrire |
Conception & Réalisation MAXIMEDIAS