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

learn more… | top users | synonyms

6
votes
3answers
13k views

wp_nav_menu(), how to change <li> class?

I'm building a menu for my website. The static is looking like this: <nav> <ul id="menu"> <li class="item_1"><a href="#">Item 1</a></li> <li ...
6
votes
6answers
2k views

Where to store PHP files created by plugin / themes

There are cases in which a plugin or theme needs to create a php file somewhere that can later include it. For example a captcha plugin, or some kind of a templating system like twig/smarty (In my ...
6
votes
2answers
2k 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 ...
6
votes
7answers
4k views

Why is wp_head() creating a top margin at the top of my theme header?

I am creating a custom theme, and elements behave as they should but when I place the <?php wp_head() ?> tag I get a top margin, at the top of my theme header. When I remove the <?php ...
6
votes
3answers
643 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, ...
6
votes
2answers
8k 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 ...
6
votes
4answers
1k views

Using Bootstrap in themes

Twitter has just came out with a new web framework called Bootstrap. What's the right way to use it within a theme? Update: The stylesheet inclusion is simple indeed. I want to know which caveats or ...
6
votes
1answer
237 views

Is there any sort of theme dependency management?

I'm developing a Wordpress theme with a few other individuals and am running into a problem where I add a plugin and then I have tell the other developers about the plugin I installed and the settings ...
6
votes
2answers
682 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 ...
6
votes
1answer
1k views

What is the difference between wp_register_sidebar_widget and register_widget?

What's the difference between them and when should we use each one ? I'm using wp_register_sidebar_widget right now and it's working fine but I've seen a lot of tutorials online on how to create a ...
6
votes
2answers
185 views

Add default Backgrounds

Is there code or a plugin that would make it possible to add default backgrounds, like you can with default headers in Twenty ten. Seems like the same frame work for backgrounds and headers.
6
votes
1answer
621 views

What is the difference between esc_html and wp_filter_nohtml_kses?

What is the exact difference between esc_html and wp_filter_nohtml_kses. Everywhere I look says that both strip all the html, the only difference I can see is to do with exactly how they do this. Does ...
6
votes
1answer
933 views

Should we use get_template_part() in functions files instead of include_once?

I'm using the theme-check plugin to check my theme for errors and recommendations, I'm using get_template_part() in theme files like header.php and index.php but in functions.php I'm using ...
6
votes
1answer
99 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 ...
6
votes
1answer
148 views

Any alternate TinyMCE4 themes / subthemes?

TinyMCE4 in WordPress 3.9 has some cool changes, but it seems to have only one "theme" included. Is there any way to make a sub-theme of the theme defined by CSS, and theme.js in ...
6
votes
1answer
397 views

WP 3.4 - what action/hook is called when theme customisation is saved?

i'm looking for the action/hook called when saving theme customs colors in the new admin interface? i need to call a custom function to save a set of php generated images. if anyone have clues... :) ...
6
votes
1answer
767 views

Mini-Site Strategy

I'm working on a project to allow a number of mini-sites within a WordPress multisite installation. Here's how it's supposed to function: The client has a large number of individual locations, each ...
5
votes
2answers
4k views

Generating CSS Files Dynamically Using PHP Scripts?

As part of my efforts to speed up my themes for my clients I am delivering my CSS via a dynamic PHP file. At the end of the called for example my_theme_css.php: This allows me to add Expiry headers ...
5
votes
2answers
405 views

What are the ADVANTAGES of ORIGINAL wordpress template structure?

Precondition: coming from a Custom PHP applications(using symfony, zend and so on) world, for me it feels unnatural to have template separated in a way that is done in original wordpress theme. e.g ...
5
votes
3answers
377 views

How to: Update live sites theme from version control repo via plugin or library? [closed]

Maybe someone knows how i could update my live sites theme from a version control*) project repository. Point is that it's really time consuming if you got your theme hosted with version control (as ...
5
votes
1answer
2k views

Why when I submit a form in wordpress it loads a 404 page though URL is correct

I am just creating a simple contact form, but I notice that it seems to post to an invalid page. The url in the browser is correct but the title of the page is "Page not found" on the top of the page ...
5
votes
4answers
4k 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' ...
5
votes
4answers
2k views

Adding a div to wrap widget content after the widget title

I'm trying to add a div to a widget's content in my dynamic sidebar. Here is the register code; register_sidebar(array( 'name' => "Sidebar1", 'id' => 'home-sidebar-1', ...
5
votes
3answers
2k views

Change admin bar to default:off

While I quite like the admin bar I actually want it to be OFF by default instead of ON ( I don't want to disable it altogether because I want users to be able to turn it on if they want - but but I ...
5
votes
2answers
6k views

Adding Language Support using .pot and .mo files to a WordPress Theme?

How do we add language support using .pot and .mo files in a WordPress theme? And how we retrieve the theme?
5
votes
2answers
672 views

Wordpress Settings API error

Hi I am trying to creating some custom options for a template I am developing but I seem to be getting an error: Warning: Illegal string offset 'show_header' in ...
5
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 ...
5
votes
1answer
7k 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 ...
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?
5
votes
5answers
1k views

Form Submitting Error with get_template_part()

I have come across an interesting problem regarding the get_template_part() . I have created a theme options page (named sitewideSettings.php) normally I would include this in functions.php like so: ...
5
votes
2answers
756 views

Are the wordpress Core css styles really all nessasary?

On WordPress Codex there are this CSS styles listed, its a quite big list of styles but it seems they are doubled unnecessary. It says: Each Theme should have these or similar styles in its ...
5
votes
2answers
4k views

how to create a conditional content_width for a wordpress theme?

I'm trying to create a conditional statement for the content width in the functions.php of my theme. So some categories will have a content_width of 580, some will have 900. This will make the oEmbed ...
5
votes
4answers
543 views

design and development workflow

We're developing a set of websites, complex ones with a lot in common, and the company have decided to use WP as a base CMS. As in every site, there is a design process, followed by HTML, then ...
5
votes
3answers
335 views

Nested comments ignored for max per page in wordpress

I have the default setting (IIRC) of 10 comments per page, and max nesting of 5 deep. The problem (or at least, minor annoyance) is that replies to comments are not counted towards that maximum of ...
5
votes
2answers
268 views

Best practice for including plugins as part of a theme?

I'm working on a theme that includes some functionality I've developed as separate plugins (as I'm hoping to release them independently). I'd like to include these plugins as part of the theme core ...
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 ...
5
votes
1answer
225 views

Why doesn't default Wordpress page view use force_balance_tags?

I noticed that the default WP theme uses force_balance_tags for listing posts' excerpts. This way, it doesn't cause major html breakage whenever someone writes a post like <div><b>This is ...
5
votes
4answers
1k views

A way to automatically install pages on theme install?

I'm trying to build a theme which would require specific pages to be included. Is there a way to automatically create pages and assign them to their page templates when a theme is installed?
5
votes
1answer
5k 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 ...
5
votes
1answer
958 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 ...
5
votes
3answers
3k views

Is it possible to stop selected plugins from loading on certain template pages?

I have a template page that has form on that is only used once in my site. The form uses form validation using jquery validate plugin (such a great plugin). Once the cart66 Plugin is loaded, the form ...
5
votes
2answers
155 views

Template for individual post designs

I browsed through the suggested posts, and couldn't find anything that was exactly answering my question. I apologize in advance if I'm reposting something obvious here, but there you have it. I want ...
5
votes
4answers
1k 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 ...
5
votes
3answers
669 views

Splitting WordPress theme CSS into multiple files, good or bad?

I'm developing a WordPress theme framework. I want organize CSS for each section into separate files for the following reasons. Developers can easily deregister styles by parent theme and load their ...
5
votes
1answer
383 views

What is the difference between WP: template_directory vs TEMPLATEPATH

I am trying to code in more consistent manner and would like to know what is the difference between WP: template_directory vs TEMPLATEPATH.
5
votes
2answers
4k views

Possible to “Attach” images to multiple posts without inserting or uploading twice?

How can I attach images to a post which have already been attached to other posts without having to upload them twice? I don't want to insert the images into the post, I simply want to attach the ...
5
votes
3answers
345 views

How to make a theme with more than one CSS file?

I've made my first theme and now I want to create different "profiles". These profiles are just independent CSS files that user can try. The point is, how to make these files to allow users to choose ...
4
votes
3answers
6k 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 ...
4
votes
1answer
1k 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' ); }); ...
4
votes
2answers
165 views

Where do I start from

I'm student web developer and I'd like to know the things I should know before venturing into WordPress. Where do I start?