When to Use Wordpress functions php


When to Use functions.php

When, then, is it really a good idea to use functions.php? I have a rule for that too: only use functions. php when the added functionality is unique to your theme.

The reasoning around this is simple: functions.php is tied to one particular theme, which means that if you switch themes, your added functionality won’t come along, forcing you to either recreate it in the new theme or abandon it altogether. This effectively disqualifies functions. php from any kind of use that controls output of content, since that would mean, when you’re switching themes, the output would not occur or, at worst, it would render the site broken and full of errors.

Most of the things you do to extend your sites will be minor, and to be honest, a lot of it would probably be better offput in the actual theme template files, keeping the plugin count to a minimum. However, some things are such a big part of the actual site that they need to be added, and nine times out of ten you’ll have chosen to add the particular functionality because you’ll need it in the long run. And while you may think that you just created the perfect theme, sooner or later you’ll end up switching to the next perfect theme, and that means that you’ll have to tackle the loss of whatever you’ve added to functions.php.

True, you can just move the code from the old theme’s functions.php file to the new one, but isn’t that just an unnecessary hassle? These are things you need to decide upon. The rule of just putting functionality in functions.php that is unique for the particular theme is a good one, I think. These things include layout settings (obsolete in a different theme) and theme option pages that would slightly change depending on how something/what is added and/or shown in the theme. Since putting that in a plugin would make the plugin obsolete when you switch themes, functions.php is a better choice.

So, plugins are for extending WordPress functionality, and functions.php is for things unique to the actual theme. That pretty much wraps it up.

Planning Your WordPress Site

Whenever you feel the need to extend the WordPress functionality on a project, you will have to figure out whether you can tweak the theme to pull offyour ideas, or if you need to develop a plugin. More often than not, when stepping outside of the typical flow of content it is a mixture of both, and that’s okay. The important thing is that there are solid ideas behind the choices being made. The obvious questions are:

The point is to establish a plan on how to build your WordPress site. This is true whether you just want to pimp your weblog, publish an online newspaper, or do something completely different altogether with the platform. Naturally, the more extreme things you do, and the further you take WordPress beyond the weblog, the more thought you’ll need to pour into the project.

Legal Disclaimer

Our website is not responsible for the information contained by this article. Webworldarticles.com is a free articles resource thus practically any visitor can submit an article. However if you notice any copyrighted material, please contact us and we will remove the article(s) in discussion right away.


This article was sent to us by: Leonardo Ferolli at 05132010

Related Articles

1. Things to Consider When Using the wordpress Database
Things to Consider When Using the Database The database is sometimes necessary to make your plugins function the way you want. From storing some simple options,...

2. Developing Plugins for WordPress MU
Developing Plugins for WordPress MU The process of developing plugins for WordPress MU doesn’t differ from that for traditional Word- Press plugins. The s...

3. Wordpress Plugins and Functions PHP
Plugins and Functions PHP WordPress themes and plugins usually work pretty much by themselves, coming together only when it comes to implementing features. Th...

4. Are you using WordPress as a CMS
WordPress as a CMS Using WordPress for things other than blogging is something that comes naturally to a lot of developers today, but not so much for the ge...

5. Things to Consider When Using WordPress as a CMS
Things to Consider When Using WordPress as a CMS So you’re considering using WordPress as a CMS for a project huh? Great, and probably a good choice too...

6. Trimming WordPress to the Essentials
Trimming WordPress to the Essentials Usually, when doing work for clients or other people within your organization, you’ll have to think a little bit diff...

7. Wordpress Static Pages and News Content
Static Pages and News Content I touched upon static Pages and categories as a news model previously. It is truly a great tool whenever you need to roll out a ty...

8. Making Widgets a Little More Dynamic
Putting Widgets to Good Use Widgets and widget areas are your friends when rolling out WordPress as a CMS. It is perhaps not as important for the small and stat...

9. Wordpress The Header and Footer Templates
The Job Board The first special project we’ll work on is a job board. You have probably seen this kind of site already, where people and companies can pos...