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

learn more… | top users | synonyms

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 ...
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 ...
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 ...
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 ...
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 ...
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.
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 ...
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?
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.... ...
2
votes
1answer
2k views

How to use logout function on custom menu link?

All I am using wordpress custom menu, and there is one menu as Logout. I know wordpress Logout function <?php echo wp_logout_url(); ?> But how can i use it in custom menu ?
2
votes
1answer
3k views

Proper use of Output Buffer

I'm attempting to use actions to override function calls I currently have throughout a template (to make updating certain replicated sections easier). For example, in archives.php I have the ...
5
votes
1answer
2k 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 ...
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 ...
5
votes
1answer
6k views

Form to Add Posts to Custom Post Type

Basically I want to display a form on my blog (on a certain page) that will allow anyone to fill it out and it will create a post in a custom post type. I saw the answer once before but I can't find ...
4
votes
3answers
7k views

Add Plugins to Wordpress Theme

I'm creating a wordpress theme that I aim to sell at some point. Now, I've discovered that some of the wordpress.org plugins would be great for things that I want to do. They already hold much of the ...
2
votes
3answers
2k views

Strict Standards Error bootstrap navwalker

I am having trouble understanding this error and I've not come across it before, please could someone help? Strict Standards: Declaration of wp_bootstrap_navwalker::start_lvl() should be compatible ...
1
vote
2answers
103 views

Guidance with The Loop for CMS

Maybe I'm going about this the wrong way but this is my scenario... I would like to use WordPress as a CMS rather than a blogging platform. I have a website that will have somewhere between 25-50 ...
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?
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 ...
5
votes
1answer
2k views

Enqueue a stylesheet for login page and make it appear in head element

I try to style the login page in my theme. Very simple: add_action( 'login_enqueue_scripts', function() { wp_enqueue_style( 'TEST', get_template_directory_uri() . '/css/login.css' ); }); ...
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 ...
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 ...
5
votes
2answers
2k views

How to add a checkbox element to attachments editor with example

The code below adds a custom input field to the attachments editor. How can I convert the text input to a checkbox and get/set the value of the checkbox on load and save? Note: "input" => ...
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, ...
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 ...
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 ...
5
votes
3answers
6k views

Get first image in a post

I am using this code directly from the codex. function echo_first_image ($postID) { $args = array( 'numberposts' => 1, 'order'=> 'ASC', 'post_mime_type' ...
1
vote
1answer
130 views

Questions about WordPress.org theme review

I have created one theme. The theme was denied today for the following reasons: Theme Review: Themes should be reviewed using define('WP_DEBUG', true); in wp-config.php Themes should ...
1
vote
2answers
823 views

How can I add an incremental class identifier to my sidebar widgets?

My sidebar widget code in functions.php looks like this... if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => 'Home Sidebar', 'id' => 'home-sidebar-widget', ...
0
votes
1answer
1k views

How to programmatically bring back “excerpts” field in post editor in WP 3.1+

My theme uses some custom options fields, like post excerpt, that were removed from the editor screen with WP 3.1 I understand and support the intent to clean up the content workspaces. However, as a ...
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', ...
1
vote
2answers
54 views

Should use widgets in this case?

We develop a new WordPress site with a new theme developed exclusively for this site. Some widgets of the same type (such as two "Bookmarks" widgets) should be styled differently (that is have ...
0
votes
1answer
86 views

Creating Page Based on Category

I'm using WordPress 4.0, and the Hemingway theme. I've created a custom page template which currently pull blog posts based on the category I give it. However I'm currently using ...
0
votes
1answer
940 views

Enabling Default Widgets in a Custom Theme

In custom theme development, how does one enable default built-in widgets? Note I mean default built-in widgets, not custom ones. I tried the following example for a WP 3.12 blog by placing it in my ...
0
votes
1answer
349 views

Formatting <code>?

I have serious trouble displaying code blocks in my theme. I want to display something like: <something> <something-else> Content </something-else> ...
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, ...
2
votes
4answers
5k views

using upload image with media_handle_upload .. but !

I'm tring to upload image in wordpress by using some function .. I found the way to upload images but there are one problem .. when the user upload his image , wordpress create more than one image ...
2
votes
6answers
1k views

What are WooCommerce starter themes? [closed]

I've done created a lot of Wordpress themes and plugins, but I haven't done much with the Wordpress WooCommerce plugin from WooThemes. If someone asked me what general theme they should work with to ...
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 ...
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 ...
5
votes
1answer
4k 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
2answers
9k views

When to use add_action('init') vs add_action('wp_enqueue_scripts')

In my theme's functions.php, I'm calling an add_action in order to gain a measure of control on where jquery is loaded (in the footer along with my theme's other scripts). The problem I'm having is ...
3
votes
2answers
549 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
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 ...
2
votes
1answer
2k views

What is the best way to export and import theme options?

So what is the best way to create an export and import feature, I tried serialize() and urlencode() on an array of options to be used in a url like so: export.php?data=(long string), and use $_GET ...
13
votes
4answers
738 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 ...
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 ...
5
votes
3answers
4k views

Plugin for custom sort order for categories?

I'd like to employ a sort order option in my theme to allow categories to be sorted similar to pages. Can anyone recommend a plugin that does this?
6
votes
3answers
1k views

Child Theme vs Duplicate Theme Renamed

Okay, I quite often see people talk about child themes and the reasons for using them instead of modifying the existing theme, but they all seem to center around the idea that if the parent theme is ...