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

learn more… | top users | synonyms

3
votes
2answers
2k views

How to determine if custom menu is active?

My theme registers custom menus with this function: function nav_menus() { if ( function_exists( 'register_nav_menus' ) ) { register_nav_menus( array('main-menu' => __( 'Main ...
3
votes
2answers
6k views

Custom post type - order field

In a custom post type, is there a way to include the "order" field that is available for pages? Is there any built-in logic that prevents duplicate values in the "order" field? The idea is to be ...
3
votes
4answers
177 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
307 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
644 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
754 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
544 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
4answers
6k 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
3answers
87 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
176 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
604 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
162 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
2answers
2k views

Custom Taxonomy Tree view

I have been trying google for this, but not so easy to search for. I have a custom hierarchical taxonomy, something along the lines of: Chainsaws - Electric - Petrol - Other Grasscutters - Electric - ...
3
votes
1answer
985 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
4answers
507 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
5k 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
4answers
2k 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 ...
3
votes
1answer
460 views

Customize WordPress>Error Page

Is there a way to customize the WordPress>error page template so that the user isn't shown just a blank screen with text? I'm not talking about 404, but when WordPress displays an error. I'd like to ...
3
votes
1answer
686 views

Theme Review: post thumbnail, header image, content width

A followup to my previous question about my theme that was rejected for the WordPress.org theme directory: RECOMMENDED: No reference to the_post_thumbnail() was found in the theme. It is ...
3
votes
2answers
186 views

Get 10 posts from a WP_Query. If less than 10, get the remainder from elsewhere

I'm trying to create a related posts WP_Query. So far, I've to created a custom WP_Query that queries all posts that match an array of tags. However, I'm trying to create a simple if statement: if ...
3
votes
1answer
138 views

Where to post/upload the new theme for WordPress theme repository

After a long dedication, I developed a GPL Theme for WordPress. I want it to be available for FREE to WordPress.org Theme Repository. But consulting many Codex resources, I found no direct link where ...
3
votes
1answer
458 views

Should I use set_transient or update_option?

I want to store some Twitter API data in WordPress. After every hour, I want to fetch new data from Twitter, and update only if the data is successfully retrieved from API (sometimes the API gives ...
3
votes
1answer
653 views

When to use esc_url, esc_html, esc_attr, and friends?

Discovered esc_url today while customizing an _s theme. I understand what the function does (sanitizes the URL inside), but what I'm unsure of is the scope of its use. It makes sense to me that if ...
3
votes
1answer
55 views

Where to put archive-{post-type}.php

I have a plugin that adds a custom post type for a website I'm building. I am using the_content filters to change how a singular page looks, and it works great, allowing me to keep everything ...
3
votes
1answer
109 views

What is the best practice for customizing a plugin's JavaScript/jQuery?

Most well written plugins support a safe means for a developer to customize/theme the plugin by copying PHP files to the theme directory and modifying the copies rather than the original plugin file. ...
3
votes
1answer
980 views

What is the difference between strip_tags and wp_filter_nohtml_kses?

What is the difference between strip_tags and wp_filter_nohtml_kses. I tried to figure wp_filter_nohtml_kses from the source but it looks like it does something a bit more complex than strip all html ...
3
votes
1answer
815 views

Reset positions of metaboxes in admin

I am writing a theme and in it I have a function which creates two metaboxes. The forth parameter of the "add_meta_box()" function I used can be set to ( high, core, default or low). I want the boxes ...
3
votes
1answer
260 views

Why max-width:97.5% on content images?

Is there a specific reason why we can find max-width:97.5% instead of 100% in common themes such as Twenty Eleven?
3
votes
2answers
876 views

How to set the default value of a option in a theme?

$shortname = "nuod"; array( "name" => "Custom Logo URL", "desc" => "Enter the link to your site's custom logo.", "id" => $shortname."_logo", "type" => "text", "std" => ...
3
votes
1answer
767 views

is_home() returns false on the home page! When is the home page NOT the home page?

I've placed the following code in my functions.php file if(!is_home()){ echo "Not Home";} if(is_home()){ echo "Home";} However, no matter what page I'm on, I get "Not Home", And I'm real sure I'm ...
3
votes
2answers
207 views

Why might $input (Settings API) be coming through empty?

I'm trying to be a good thememaker and pass all my settings through the Settings API, but I'm running into some difficulty in the sanitization callback function. The core of the problem is this: the ...
3
votes
3answers
2k views

Integrating plugins in themes

I could not find a thread discussing this, so starting this one. I am currently working on a rather elaborate theme for 3.1+, and by elaborate I mean that in addition to styling and regular front-end ...
3
votes
2answers
574 views

Seeking clarification on page request life-cycle

I'm just trying to get my head around the "life-cycle" of a typical page request in WordPress. The Action Reference page lists 38 actions that occur during a typical page load, but two things aren't ...
3
votes
2answers
550 views

Add a preview to a Wordpress Control Panel

I'm trying to create a new wordpress template and inside it I added a Control Panel, inside this control panel there is an option that allows user to choose where he want's to place a on a map, I try ...
3
votes
3answers
3k views

Can You Export Theme Settings From WordPress Multisite?

I do local WP development on a WordPress Multisite instance. What is the best way to move theme settings from there to the live instance? By theme settings I am talking about widgets and theme ...
3
votes
3answers
1k views

Automatic Updates For Private And Commercial Themes?

Is there any way to get wordpress to check for, download private theme updates? I found this plugin for private plugin updates.... ...
3
votes
1answer
120 views

What is best practice for writing/using custom PHP classes in a theme?

I want to use a custom PHP class in my theme, however I am not sure where to add it. Is there best practice used by the community for including PHP classes with a theme or is that an individual ...
3
votes
1answer
154 views

Get file headers in custom file

in my one of my plugins i have modules (kind of like plugins in a plugin), is there a function like get_plugin_data() or wp_get_theme() that will allow me to get the header section of a custom file ...
3
votes
3answers
2k views

How to remove duplicate link from add_menu_page

In the theme admin menu below, the "MyTheme Menu Label" is being duplicated twice on the sidebar menu, once for the main menu link and again for the first submenu link. How can I remove the 2nd ...
3
votes
2answers
86 views

Active theme responds to theme change request to alert user

I'm trying to intercept the install themes routine in order to alert the user from the active theme. I'm cobbling together a crude javascript alert below. What are some other options? if ( ...
3
votes
4answers
712 views

Run shortcode before filters

My users post snippets code in comments. I created a shortcode for this : function post_codigo($atts,$content=""){ return '<code>'.$content.'</code>'; } ...
3
votes
2answers
1k views

How to get Images included in Post

is possible to get images added to a post programmatically? I am working on custom template (my first) and I need to display Images added to a post in specific way.(first image as title image and the ...
3
votes
1answer
392 views

How to call the_excerpt() with tags or the_content() as an excerpt?

Is it possible to call the_excerpt() with tags intact? I'd like to create a excerpted listing of my posts in a specific category, but I'd also like the links and formatting carried over from the post ...
3
votes
1answer
70 views

Translate third party plugin and save translation files in custom theme

I'm using Codestyling Localization and I want to translate a plugin and I want the translation files to be saved in the translation directory in the theme I'm building and not in the plugins ...
3
votes
1answer
64 views

Confused about image sizing business in Wordpress

I'm creating my first Wordpress theme and I've got everything working fine, and by following this tutorial and few others I've understood how to add custom image sizes by using add_image_size() ...
3
votes
1answer
137 views

How to add a section to the menus configuration, offering hard coded items?

So, let me explain what I'm actually trying to do, maybe there's a better way to achieve it. I'm working on a theme, and I'd like the user to be able to easily position "special" items in the menu ...
3
votes
1answer
1k views

Show a user their recently viewed posts

I am working on a project that showcases a number of products, so I'd like to add a "recently viewed product" selection that keeps track of the last 5 or so viewed products or posts. I saw this ...
3
votes
1answer
2k views

wp_remote_get doesn't work with secure connections https?

I'm querying the twitter api when I use non secure connection http:// it works fine no wp_error (but twitter exceed limit error) but when I use https:// it works in my browser I can see the json and ...