Themes create the public (front-end) interface for a WordPress site.

learn more… | top users | synonyms

52
votes
27answers
8k views

Software for WordPress Theme and Plugin Development? [closed]

What software do you use for your WordPress related needs? Please state your OS. On windows XP I use: filezilla (FTP) notepad++ (for reading of PHP / CSS files) firebug (a firefox extension to ...
48
votes
3answers
54k views

Menu items description? Custom Walker for wp_nav_menu()

Normal Wordpress Menu looks like: Home | Blog | About us | Contact But I've seen many pages with descriptions under these links: Home Page | Our Blogs | About us | ...
42
votes
2answers
18k views

What is the preferred way to add custom javascript files to the site?

I've already added my scripts, but I wanted to know the preferred way. I just put a <script> tag directly in the header.php of my template. Is there a preferred method of inserting external or ...
37
votes
6answers
6k views

framework for plugin/theme options panel? [closed]

I found that the longest part of a plugin or theme development is creating the options panel, at least in my case. So i like to know what's your take on that. Do you use a ready made framework or ...
29
votes
4answers
6k views

Where to put my code: plugin or functions.php?

Is there an easy to understand scheme to decide what kind of code belongs to a plugin or the theme’s functions.php? There are many cases and many debates about that topic, mostly because there are ...
29
votes
9answers
6k views

What process do you use for WordPress development?

I'm interested in how other people develop themes and plugins for WordPress. To me, the in-browser editor in the admin panel just doesn't cut it. Currently, I'm just using an IDE with a PHP plugin ...
27
votes
2answers
6k views

Autoloading & Namespaces in WordPress Plugins & Themes: Can it Work?

Has anyone used autoloading and/or PHP namespaces within a plugin or theme? Thoughts on using them? Any harm? Pitfalls? Note: namespaces are PHP 5.3+ only. Assume, for this question, that you know ...
23
votes
9answers
15k views

How to detect mobile devices and present them a specific theme?

I would like to create a new modified version of my theme (check my profile if needed) to present to visitors if I detect that they are visiting the site from a hand-held device, like iPhone, Android, ...
20
votes
4answers
48k views

How do I get the theme URL in PHP?

I need to get the URL of my theme directory to reference an image in the theme's image/headers directory. How is this done in PHP?
18
votes
4answers
3k views

How To extend WP_Customize_Control

I'm looking for a way to add a new kind of control to the customize live preview panel. I have seen how to add new sections to the panel using add_action( 'customize_register'... The control I want ...
15
votes
1answer
6k views

What is the constant WP_USE_THEMES for?

Regarding the WP_USE_THEMES constant, the Codex states: If you are using The Loop inside your own design (and your own design is not a template), set WP_USE_THEMES to false. But what is ...
14
votes
2answers
8k views

When to use is_home() vs is_front_page()?

I've found that is_front_page appears to return true when I'm viewing the home page and have a single sticky post assigned there. It also returns true when I've assigned a page as the static front ...
14
votes
2answers
5k views

How to show a custom meta box on the “Quick Edit” screen?

I've used add_meta_box() to add a custom meta box to the WordPress edit window on both pages and posts. How can I make this meta box also show on the "Quick Edit" screen? Ideally, I'd like it to ...
14
votes
6answers
449 views

What questions do you ask when asked to give an estimate on theme development?

I just recieved an email that asked the following question: "How much will cost to code a WordPress theme?" I cannot answer this question without know the answer to a plethora of other questions. I ...
13
votes
4answers
737 views

Why have <?php and ?> on every line

I've seen this convention pretty much everywhere, and, at times, it comes close to driving me nuts: <?php //The loop ?> <?php while ( have_posts() ) : the_post(); ?> <?php ...
13
votes
3answers
2k views

How important is it to enqueue a theme's stylesheet?

I have trawled the net looking for an answer to this, but for some reason all I can find are actual examples, but without that particular explanation, which is clear say in the case of scripts. Can ...
13
votes
5answers
4k views

How Do I Protect My Premium WordPress App Theme from Copying?

They say WordPress is GPL, and therefore all plugins and themes made with it are supposed to be GPL. Fine, but if I spent three months coding an extremely complex app theme with the intent on selling ...
13
votes
1answer
2k views

Worthwhile to restrict direct access of theme files?

I've run across the following snippet in themes from time to time: if ( ! defined('ABSPATH')) exit('restricted access'); It's at the beginning of some (all?) PHP files in a theme and it's supposed ...
12
votes
3answers
8k views

What's the difference between home.php and index.php?

If I create a home.php file, it seems that WP will use that instead of index.php, so index.php is never used? What are the differences between these two template files (located in the theme folder)? ...
11
votes
1answer
18k views

How to add posts to custom menus?

I'm just beginning to work the "Custom Menu" functionality that was introduced in 3.0 into my theme. I like everything about this new capability and API, with one exception: Why no posts? I can ...
11
votes
3answers
1k views

get_template_part vs action hooks in themes

It seems to me both of these afford the opportunity for the end user to modify a theme without actually editing the themes files (via child themes). My question is, is one method preferred over the ...
11
votes
8answers
1k views

Where can I learn to create my own theme?

I want to learn how to create a theme for WordPress. Where can I find information and resources on how to do it?
11
votes
2answers
1k views

pass object/JSON to wp_localize_script

I've got a working piece of javascript that contains an object literal. But I need to localize it, and I'm ytrying to figure out how to rewrite it so that I can get wp_localize_script() to accet it, ...
11
votes
3answers
616 views

Wordpress API Menu/Submenu Order

I'm developing a child-theme using Wordpress 3.4.2 and the development version of the Options Framework by David Price. This is my first theme and I'm relatively new to this, so I've had a look into ...
10
votes
2answers
2k views

Does the functions.php file ever get called during an AJAX call? Debug AJAX

Trying to figure out an issue a fellow programmer is having. I was wondering if the functions.php file get called at all when you do admin side AJAX? I know that when you do an AJAX call a part of ...
10
votes
1answer
3k views

How can I add a URL field to the attachments window?

For example... add_action('init', 'reg_tax'); function reg_tax() { register_taxonomy_for_object_type('category', 'attachment'); } Adds a "Category" input field to the media manager and ...
10
votes
2answers
635 views

Single functions.php or split into many small files?

I am creating a simple framework with theme options. I have divided chunks of code within functions.php and placed it within a specific folder structure. Now in my main functions.php file, I only ...
10
votes
4answers
4k views

Solutions for generating dynamic javascript / CSS

Let's say you need to generate javascript or CSS code that depends on the current context. For example you have a form on the homepage that fires an ajax request on submit, and a different form on ...
9
votes
4answers
6k views

Theme Activate Hook

I would like to write a function to email me the URL of the website when my theme is activated. What is the hook initiated when the theme is activated?
9
votes
5answers
6k views

Including jQuery and JavaScript files the correct way

I'm having some trouble with this. I'm not sure how to do it the correct way, and I read so many different techniques and ways to do it that I don't know what to make of it. Some questions and ...
9
votes
2answers
7k views

How to Link External jQuery/Javascript files with WordPress

So I'm using Starkers to base my next WP theme on and I've run into a small issue, I was including my own version of jQuery in the header.php file but when inspecting my site using Firebug I noticed ...
9
votes
4answers
2k views

after_setup_theme always runs

I am setting up a child theme for some of my faculty members, and as a part of the theme, I would like a handful of plugins to be activated at the time that the theme is activated. So, naturally, I ...
9
votes
2answers
2k views

Is wp_is_mobile() effective?

I'm going to test the user agent to load a mobile template instead of the desktop theme. There are many mobile detection scripts out there. Does wp_is_mobile() function work well? What is your ...
9
votes
1answer
2k views

Using classes instead of global functions in functions.php

In many themes I've seen (including TwentyEleven) and in the examples I've found online, when building the functions.php file for a theme all functionality is declared in a global scope. To clarify, ...
8
votes
3answers
2k views

Should Plugin Folders Include a Blank index.php File?

WordPress itself, in the wp-content folder, includes an empty PHP file which looks like this. <?php // Silence is golden. ?> Should plugins include an empty file like this as well to stop ...
8
votes
2answers
10k views

WordPress Theme Preview Image

I'm developing a custom WordPress theme. When I go to select themes in the Appearance menu, my theme does not have a preview image. Is there something I need to do to get a preview image to show up? I ...
8
votes
1answer
335 views

WordPress Themes and PHP unit

Is there any examples of using PHP unit tests with WordPress themes, seems a lot of blogs out there on the subject are out dated as the core unit tests are apart of trac, yet last night - I pulled ...
8
votes
2answers
768 views

Theme customizer - settings order

If I add more than 5 Settings to a single section, the order of the settings gets weird. For example: // Link color $wp_customize->add_setting( 'tonal_'.$themeslug.'_settings[link_color1]', ...
8
votes
3answers
3k views

How do I add version control to my workflow?

I develop themes, lots of them. I am given a PSD, code up the HTML/CSS, slap the code into Wordpress, and make corrections as they get QC'd. Once live, clients can edit blog posts like normal or ...
8
votes
2answers
3k views

Making update notification functionality for my themes

the question is simple :) I am making a theme that i will use in lots of sites. So, i don't want to go all the site and ftp the files every time i fix a bug or do a theme upgrade. Is there any way i ...
7
votes
3answers
2k views

CSS classes for theme

Does anybody know predefined (suggested by WP) CSS classes which should I use in my theme? I have seen somewhere in Internet a list of all CSS classes, which are used in WP theme, but can't find it. ...
7
votes
4answers
521 views

Do I actually need to link my theme's style.css in the theme files

So I am developing a wordpress theme using a series of LESS files for the CSS. These compile using codekit to a combined and minifed stylesheet that I use for the theme's styling. I understand a ...
7
votes
1answer
4k views

What is a Theme textdomain?

I've found that any WordPress theme uses this functions, but I don't understand what is the purpose of it and what is it, in this case 'themify'? Here are some examples in Themify functions.php: 1). ...
7
votes
1answer
2k views

What is the advantage of using wp_mail?

What is the advantage of using wp_mail() over mail(). Codex says they're similar, but they seem to be very similar.
7
votes
3answers
752 views

Get 'page' number with infinite scroll

I added infinite scroll support of the Jetpack plugin to my own theme using this tutorial: add_theme_support( 'infinite-scroll', array( 'container' => 'content', 'footer' => false, ...
7
votes
2answers
3k views

What are the advantages and disadvantages of Option Tree over the Customization API?

I'm relatively new to WordPress theme development, and I had to create a theme with options available. I did a Google search to see what are the possibilities, and I read articles about such, and read ...
7
votes
2answers
1k views

Add Caret to Menu Items with Sub-Menus in WordPress Theme

I'm working on a custom theme using wp_nav_menu(). What I want to do is add a caret to menu items that have sub-menus. For example, If my menu looks like this: Menu Item 1 Menu Item 2 Menu Item ...
7
votes
2answers
6k views

Display Menu Name using wp_nav_menu

I have a custom menu that I can call just fine using wp_nav_menu. Is there a way to have the menu name displayed inside an h3 tag before the menu? Ex. <h3>My Menu Name</h3> <nav> ...
7
votes
2answers
1k views

how can I add an icon/image for a child theme?

I have set up a child theme of the twentyten theme. In the themes section that under the appearance, I can only see the child theme's title, author name, and a grey box above it. How can I add an ...
7
votes
1answer
147 views

Get entered value of customiser field for live preview

As per the codex, this question an probably any tutorial on the theme customiser out there, you get the value of a customiser field with the following code: ( function( $ ) { //Update site ...