Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm building a custom theme that I will reuse on more than one site and would like to be able to configure some things from the admin. For example setting the Twitter and Facebook pages links without hardcoding them in the template.

What's the best way to do this? Should I put them in wp-config or should I have some sort of custom fields? These settings should be global to one site.

share|improve this question
add comment

3 Answers

Neither. Make a theme option panel. There are plenty of open source ones on Github.

share|improve this answer
    
Gotcha, thanks for the answer –  L. De Leo Nov 29 '12 at 21:02
    
Not sure why the downvote given its a theme that you want to define options for, ergo a theme option panel is the most applicable solution. –  Chris Nov 29 '12 at 21:07
3  
Because there's no real substance to the answer. It's a valid suggestion, but show us how to do it -- or point to some examples and explain how they do it. –  chrisguitarguy Nov 29 '12 at 22:58
    
@chrisguitarguy In this case it is detrimental to point to examples. Doing so incurs bias. For example, lets say I point to example A. OP and future users will be more baised towards using that particular franework over others even if the one pointed to is over or under featured, or doesn't adequately cover the needs of the developer. WPSE has taken the stance that we are no longer to do recommendations on frameworks, plugins or themes in the site guidlines. Therefore I am only supposed to offer the idea. –  Chris Nov 30 '12 at 0:19
    
@chrisguitarguy One way of looking at it is like when on StackOverflow you get a kid who needs help with homework. You dont give him the answer or point him to it, you give him suggestions or pointers so he can come to his own conclusion. Same thing here. The OP should be able to go out and research and by doing so would find a theme options framework suited to his actual needs without any pretense of bias towards one. –  Chris Nov 30 '12 at 0:21
show 2 more comments

You should make a plugin, that way it is portable to any theme.

Generally speaking people need to stop filling up functions.php or theme files with code that is better suited for scalability and flexibility, aka a plugin.

share|improve this answer
    
OP specifically stated this is for one theme. If so, why make a plugin. Then users or OP have to install both a plugin and a theme. –  Chris Nov 30 '12 at 9:38
    
For re-usability a plugin trumps a theme when it comes to portable code, it's a more modular approach –  Wyck Nov 30 '12 at 16:32
    
But hes not designing it to be reusable. He's designing it for a specific theme. If he needs it for another theme he could always just copy and paste the theme code, which takes exactly the same effort as installing said plugin but without a plugin needed. –  Chris Nov 30 '12 at 17:37
    
No in fact it takes more effort, I'm sorry but you're going to go nowhere arguing copy/paste management beats a modular scalable system. –  Wyck Nov 30 '12 at 17:58
    
How is a plugin more modular or scalable than a theme options framework? –  Chris Dec 1 '12 at 9:09
show 1 more comment

Custom theme control panels are no longer the preferred way of offering options for WordPress themes. Instead you should use the built in theme customizer:

http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own-themes/

share|improve this answer
    
Alot of people, particularly people who are not familiar with web development, like clients, do not like the customizer at all. They would prefer to be able to set everything from one page. Sure you can add all the options of a control panel to the customizer on the home page, but given the amount of space customizer has if you have a theme with a lot of options this is not a solution that is suitable. –  Chris Nov 30 '12 at 9:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.