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

learn more… | top users | synonyms

4
votes
1answer
3k views

How to set permalink structure via functions.php

I'm setting up a Wordpress Network and wanted all new sites to have the same permalink structure (i.e. "/%year%/%monthnum%/%postname%/"). I'm wondering if this is possible to do via hooks or hacks in ...
4
votes
1answer
132 views

function_exists call in function.php

In the function.php file of the twentyeleven the setup function checks to see whether it exists before running it: if (!function_exists('twentyelevent_setup')): function twentyelevent_setup() { ... ...
4
votes
3answers
5k views

How to get gallery images?

I have some images uploaded in wordpress posts (eg. post#1, and post#2). Now I've created a new post (eg. Post#3), and in this post I have inserted the WordPress 3.5 gallery, I did not upload any ...
4
votes
2answers
47 views

What is the correct way for a theme to support plugin UIs?

For instance if my plugin is creating a form on a page, what can I do to make it as easy as possible for theme developers to skin the form too?
4
votes
1answer
5k views

Can I create my own “Recent Posts” widget or customize the existing one?

I'd like to enable the Recent posts widget with the ability to show a "View All" link when there are more posts than I've currently got the widget set to show. I'd also like to be able to exclude ...
4
votes
3answers
1k views

Hide wordpress plugins from list

I am using a couple of wordpress plugins for my theme, enabling them programmatically. I would not want the user of my theme to be bugged with plugin updates for these plugins, as well as viewing ...
4
votes
1answer
3k views

Pages: frontpage.php, home.php, posts page etc

When do I use the following: home.php frontpage.php Under Settings > Reading Settings Front Page Posts Page I wish to clarify this as I find myself using "Placeholder Pages", empty pages just ...
4
votes
3answers
20k views

WooCommerce shop page to use my custom template

Before asking the question I want to tell you that I have already asked the question in http://stackoverflow.com/questions/15025213/wordpress-woocommerce-template-file-overiding I am using the ...
4
votes
2answers
1k views

PHP unit testing WordPress?

Given how WordPress is written and how it interacts with a database and given how its not very much OOP oriented, is there a way to unit test a theme? is there a way unit test a framework (not a theme ...
4
votes
3answers
978 views

Posts in multiple Categories different single.php

I am smashing my head against some code. Here is the situation: I have one post in 3 different categories, this post has to be visible in "category 1" with the single1.php, in "category 2" with ...
4
votes
1answer
70 views

When coding a Wordpress theme, where does the theme (i.e. the presentation) end and the plugin (i.e. the functionality) begin?

The best guideline I have seen for what should be in a theme is to put "functionality" in a plugin. I am looking at adding more "premium features" like jQuery image sliders. This requires a back-end ...
4
votes
4answers
13k views

Twenty Eleven home page show only excerpt

I am using the brand new twenty eleven theme, my home page is set to show latest posts, but it displays the entire posts, I want to only show the excerpts, not the entire content, Here is the ...
4
votes
2answers
345 views

Custom theme/plugin update checks

At the moment, Wordpress checks the wordpress core for it's updates. But, I'd like to add an additional check to repeat the process for themes and plugins using a seperate address, for updating ...
4
votes
2answers
754 views

Any official way to create an admin theme?

I was wondering whether there's a common way of customising the aspect of the admin panel. I know you can play with the css and js files but what I was looking for is some kind of "admin theme" like ...
4
votes
1answer
1k views

How to store widget fields data as an array?

I am creating a widget, it needs to store about 10 IDs. Right now I'm using following field method to store each of the ID in a separate field. It stores data of each field in a separately in the ...
4
votes
2answers
555 views

Add custom user capabilities before or after the custom user role has been added?

Should custom user capabilities be added before the custom user role has been added, or the other way around? add_role() asks for and array of $capabilities in the third parameter of the function. ...
4
votes
1answer
570 views

How do I add settings to the Background Options Page?

I am developing a theme and I wanted to add some extra content to the built in background options page. I know how to use the settings API to create new theme options and settings but I can't seem to ...
4
votes
1answer
679 views

How To Add New Option Types To Option Tree?

I am using option tree in theme mode and child theme mode and I am trying to add new option types. The new option types will be based off of the post-select option type, but will only list posts from ...
4
votes
1answer
91 views

Update exisiting site to 3.5 release candidate

I have an existing site that I want to update to 3.5 now, because I want to see if my plugins and themes work in it. I don't want to wait for the full release (when I'll be able to automatically ...
4
votes
1answer
334 views

Setting multiple default background images?

The following code lets me set a default background image. Is it possible to set multiple custom backgrounds? add_theme_support( 'custom-background', array( 'default-image' => ...
4
votes
4answers
842 views

How to make plugin required in a wp theme without using php conditional statements when calling an individual function from that plugin?

One of my Wordpress themes requires a few third party plugins to run correctly. Most of the times I used to call functions from third party plugins using conditional statements like ...
4
votes
2answers
1k views

Add a new checkbox in theme options

I'm trying to add a new option to a theme options panel to hide/show the comments links in the theme template files. I've got the option to show up in the panel, but there's something wrong in that ...
4
votes
1answer
92 views

Is having multiple theme customizers for different pages possible?

If you have a theme that for instance has a blog, front page and misc pages is it possible to have more than one theme customizer, so that you can provide a live preview when editing styles? My theme ...
4
votes
5answers
224 views

Remove settings if theme is deleted?

Is it possible to perform an action only if the theme is deleted (not deactivated) from the theme directory ? For example, I want to remove the theme settings from database after the theme is ...
4
votes
1answer
254 views

How do I show sticky posts on a static front page that also contains content?

In my theme, I'm using front-page.php for the static front page. I'm also using a page to store the content on the static front page. The front-page.php file is set up to show the content from that ...
4
votes
1answer
760 views

Best practices - Should I create a child theme vs. customizing a framework theme? (such as HTML5 reset)

I have built quite a number of wordpress sites and have worked frequently with the HTML5 reset theme. My workflow has been to simply edit the files in the theme because I often use quite a bit of ...
4
votes
3answers
2k views

wp_nav_menu sort order?

Hey Guys, I'm trying to build a right aligned, wrapping capable wp_nav_menu powered menu. Is there a way to have it rendered backwards, so that float: right; would work and not mess up the order? I ...
4
votes
4answers
122 views

Any walker causes blank menu?

Using the following, or any other custom Walker_Nav_Menu seems to cause a blank navigation menu, I tried specifying the default to make sure I wasn't going crazy yet it still blanks the output... Any ...
3
votes
5answers
8k views

How to customize wordpress login/register pages?

My question is how do I customize the default WordPress login and register page without editing WP's core files. I'm thinking more along the lines of a functions.php code. Can anyone help me out by ...
3
votes
3answers
998 views

How to enqueue script if widget is displayed on page?

I created a widget that uses a jquery plugin, and I used is_active_widget to enqueue the script, it's working fine but it's also including the script even on pages that doesn't show this widget. so is ...
3
votes
2answers
4k views

How can I get page slug

How can I get the slug of a page or post?
3
votes
2answers
261 views

How can you develop on a live WordPress installation that is using W3 Total Cache?

Or to make it easier: you just want to disable the caching in order to see your changes in realtime. Any solution that would allow you to disable caching based on IP, logged user or cookie will be ...
3
votes
4answers
170 views

How to disable 3.1 “Admin Bar” via script for the admin user?

Every time I create a new site under 3.1, my first trip is to the Users > Admin User profile page to uncheck the "admin bar" checkbox. I'd like to place a script in my theme's functions.php to do ...
3
votes
1answer
3k views

Show a WP 3.0 Custom Menu in an HTML Select with Auto-Navigation?

As part of a theme for a client, I want to be able to show a custom menu (defined via the admin) in a select box that automatically changes pages after changing the selection. Is there a plugin (or a ...
3
votes
2answers
239 views

How to concatenate inside the _e() function the right way?

I'm trying to create a function for the title inside my functions.php, I'm having a problem with the search title part where I have to concatenate here's the part with issues: elseif (is_search()) { ...
3
votes
2answers
569 views

jQuery in header or footer

From my reading it seems there is a good case for loading scripts like jquery and dependencies into the footer as a preference if possible; however 2 things confuse me which. Firstly the default for ...
3
votes
1answer
665 views

do_shortcode() doesn't do shortcodes ;)

Imagine this basic shortcode in your functions.php file: function div_shortcode( $atts ) { return '<div class="div"></div>'; } add_shortcode('div', 'div_shortcode'); So every [div] ...
3
votes
2answers
501 views

Add a notice to users upon first login to the admin area

I'd like to give users a little welcome message on their first login to the admin area. Once they hide the message it should not appear again. I noticed admin_notice is a hook but don't know where to ...
3
votes
3answers
86 views

reason of splitting theme files to multiple files

I can create my theme without splitting it into separate files. Why do theme developers split WordPress theme into a few single files like header.php sidebar.php and etc?
3
votes
1answer
158 views

What is the purpose of an extra file for translation?

What code is required to put in functions.php in order to make the theme translation ready? The TwentyEleven theme has only following line: load_theme_textdomain( 'twentyeleven', ...
3
votes
1answer
421 views

Why to check if function doesn't exists in functions.php?

I see in the twentyeleven theme, before most custom functions they check if it exists <?php if ( ! function_exists( 'twentyeleven_comment' ) ) : function twentyeleven_comment( $comment, $args, ...
3
votes
1answer
150 views

How to display wp_nav_menu() conditionally only when not on a 404 page?

I made a custom design for my site. On my header i put my navigation so everytime i call the header the navigation will be called to, so that i would not be calling it all the time. But now i have a ...
3
votes
1answer
827 views

What is the best book to learn how to make themes for wordpress?

Do you any good book or video tutorials that easily explain how can I make my own theme for Wordpress? and how to change the structure of the content? Cheers.
3
votes
2answers
189 views

Is it proper to create a page just to generate a listing page (eg. for a custom post type)

I find myself creating pages just as a "placeholder" to a listing page. eg. I create a page "Blog" and "Portfolio". Both has the editor emtpy. And I just use it so that I can use page-blog.php and ...
3
votes
1answer
638 views

Call dynamic_sidebar but include/exclude named widgets?

Is it possible to include or exclude specific named widgets that are assigned to a named dynamic_sidebar call? For example, if I've registered a sidebar named "my_sidebar" and the user had placed a ...
3
votes
4answers
471 views

Suggestions for creative use of post format feature, or themes that use them well

I'm looking for themes or examples of sites that use the post format feature in an interesting way. I suppose adding special styling for each post format would be a good start. But if anyone knows ...
3
votes
3answers
4k views

How to add a WYSIWYG text editor to the Category Edit Screen

I've been working lots with categories lately, what with the increased awareness and demand for themed or silo'd site structures. To that end, I'm looking to enhance my category landing pages by ...
3
votes
3answers
877 views

“Quick Edit” > update clears out my custom meta values

I have two custom meta fields that I've enabled for each post, scottb_customHeader and scottb_customTitle These work fine as long as I'm using the full edit feature to edit posts. However, when I ...
3
votes
4answers
5k views

wp_nav_menu() custom container and container_id

So today I started work on my first Wordpress theme and so far it's been a lot of fun. However, I have had difficulty in getting wp_nav_menu() to do what I want. Here's what I want: <nav ...
3
votes
4answers
994 views

With Wordpress themes, where do I store the images and files relatively?

In pure HTML, I'm used to storing the files relative to where the particular HTML file is, such as css/style.css. However, with the theme I'm using with Wordpress, "Responsive" I don't know where the ...