Within the context of WordPress Theme-ing, the term 'template' refers to PHP files used to display content.
28
votes
3answers
2k views
Opinions and recommendations on the best barebones base theme [closed]
Preamble
I'm finding myself building more and more WP sites "from scratch" as it were (ie: ignoring any theme designs out there and just creating a design wireframe purely on the needs of the client. ...
18
votes
9answers
16k views
get name of the current template file
I've found this to display the current name of the file used in template:
function get_template_name () {
foreach ( debug_backtrace() as $called_file ) {
foreach ( $called_file as $index ...
12
votes
1answer
7k views
Create custom page templates with plugins?
Is it possible to make custom page templates available from a plugin?
11
votes
1answer
15k views
How to change the default registration email ? (plugin and/or non-plugin)
After a new user registration, WP sends out an email with the login / password, and a link to the login page.
Is there a way to change this defaut email template? I'd also like to change the subject ...
11
votes
4answers
3k views
single-{$post_type}-{slug}.php for custom post types
My favorite part of the Wordpress template hierarchy is the ability to quickly create template files for pages by slug, without having to edit the page in Wordpress to select a template.
We can ...
9
votes
2answers
4k views
Get custom post_type's archive URL
It seems like stupid question. But, I can't figure it out :(.
I need to display button at home that goes to custom post_type's archive URL (archive-{post_type}.php). How do I do that?
8
votes
8answers
4k views
How do you find out which template page is serving the current page?
When you activate a wordpress theme, it's always a hassle to find out which file to go to change things.
Any idea how to simplify things?
But on the other hand, considering the get_template_part ...
8
votes
3answers
5k 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)?
...
8
votes
4answers
1k views
Is there a WordPress plugin that registers a plugin file as a custom page template?
I need to create a plugin that makes custom page templates available in wp-admin. I'm wondering if someone has tackled this already, as it seems like a pretty typical process?
8
votes
2answers
366 views
What's the purpose of the paged.php file?
In context of the template hierarchy chart? From what i gather, the paged.php file is something to do with an archive?
7
votes
3answers
1k views
Can't get a custom template taxonomy page to display
I've been trying to wade my way through learning the ins and outs of taxonomies and how to integrate them into themes and I've run into a pretty basic issue that I can't seem to figure out.
I started ...
6
votes
3answers
6k views
How do I get the size of an attachment file?
I'm using the following template code to display attachment links:
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => ...
6
votes
3answers
196 views
Is there any way to use get_template_part() with folders?
I'm wondering if there is any way to use get_template_part() with folders? My main folder has a lot of files now because I put every re-usable element in a separate file. I'd like to put them in ...
6
votes
1answer
4k views
How to create custom URL routes?
I have a very peculiar requirement, hopefully I can explain it without being too confusing. I created a page template where I list some properties I get from an external XML file, so far no problems, ...
6
votes
2answers
9k views
Adding Page Attributes Metabox and Page Templates to the Posts Edit Page?
(Moderators note: Title was originally "How can I add the "Page Attributes" and/or "Page Attributes > Template" selector to POSTS editor")
WP currently only allows the assignment of a "template" to ...
6
votes
1answer
3k views
Taxonomy, Terms, and Template Files
I have post type 'product' and hierarchical taxonomy 'types' attached to it. In this taxonomy, I have terms: 'dry-clean', 'washer', etc. With several sub terms on each terms.
In my situation, I need ...
5
votes
5answers
324 views
Updating WordPress overwriting customization tweaks - strategies?
Twice now I've updated wordpress, only to realise that (facepalm) it overwrites some changes I've made to the custom template - to sidebar or something similar.
Obviously I don't HAVE to update, ...
5
votes
3answers
3k views
Any advantage to using get_header() over include('header.php')?
The basic theme - in fact every theme I've looked at - uses get_header() to include the header file, but I don't see any reason for doing so.
What's are the advantages of using get_header() instead ...
5
votes
3answers
2k views
Creating a default Custom Post Template that a Theme can override
I'm in the midst of building a Wordpress Plugin that adds a custom post type, for which I'd like to include a default template to display. Essentially, this is an event management plugin, and the ...
5
votes
2answers
2k views
How to customize the default HTML for Wordpress Attachments
I'm using Wordpress 3.0.1 (most recent as of now) and working around the Whiteboard theme.
It seems that for attachments (images, specifically), Wordpress generates the HTML automatically and it ...
5
votes
2answers
308 views
Looking for WordPress System Diagrams
I am looking for WordPress chart/diagram system design.
I found only the template hierarchy diagram, but it's only part of the system.
source: ...
5
votes
3answers
2k 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 ...
4
votes
5answers
227 views
How to show a under construction page for a domain but still be able to work on index.php?
I installed a WordPress for a domain name. When I use this domain name will point to index.php in my template. I want show a under construction page for this domain name, but the other hand I still ...
4
votes
5answers
2k views
Different widgets on different page templates?
If I have a couple of different Page templates, how would I show a different collection of sidebar widgets for each of these templates? I'm using the Starkers theme as a starting point.
4
votes
2answers
618 views
What are the current recommended best-practices for comments.php?
I'm getting ready to submit a theme to the .Org repo and wanted to make sure that everything is in ordnung. One of the biggest holes left in my design is the comments template.
I've taken a look at ...
4
votes
3answers
510 views
Print WordPress template filename(s) for debugging
I've taken over the maintainance of a large WP-MS powered site. The site has ~200 templates, many page specific, and with no standard naming procedure.
It would save a lot of time if while surfing ...
4
votes
3answers
643 views
Custom Post Types 404 Issue
I dont know why my custom post types render the Page not found. This is the code I am using to register custom posts.
www.example.com/products/product1/ renders 404 where as ...
4
votes
4answers
3k views
Dynamic template serving, change theme_root using add_filter from current theme
Some plugins use the 'template', 'option_template' and 'option_stylesheet' to dynamically serve (alternative) wordpress templates. For example, Nathan Rice's ServeDefaultToIESix.
For Example -
...
4
votes
3answers
264 views
How to control output of custom post type without modifying theme?
I have a custom post type 'properties' that I'd like to control the HTML output for. For simplicity, let's focus on the archive view.
As a basic example, here is what a loop looks like in an ...
4
votes
2answers
209 views
Child Theme: how to override variables?
I'm going to build my first Child Theme. I understood how to override functions (hope!), but how to override variables?
For example, in a Premium Template I want to change the values of feed variables ...
4
votes
1answer
517 views
How to get IDs for objects in menu branch?
Is it possible to print content of all menu items, when displaying menu (or branch of menu as in question about displaying menu branches) ?
Once I click on About Us I wish for new page to display ...
4
votes
1answer
992 views
wp_get_attachment_image returns different image size
It is a bug?
wp_get_attachment_image( $attachment_id, 'post-thumb-size-small');
Same code, called in template, and in AJAX call returns same image SRC, but different image width and height.
dumb ...
4
votes
1answer
71 views
add/apend templates 'transparently' via plugin to currently active theme or child theme?
Cross posting my trac question here in the slim hopes that someone here has run into the same issue and has already come up with some proof of concept code I can try:
In building a custom 'theme ...
3
votes
4answers
1k views
Consuming an external API in WordPress?
I have a client who has a WordPress website, and he want to extend it to add new functionalities. These functionalities are included in a website I have already done (a kind of search engine over a ...
3
votes
1answer
650 views
Template issues getting ajax search results
I'm trying to put search results into a div with ajax. The issue is I'm getting errors saying undefined function have_posts() when the the search template is accessed. It also took issue with ...
3
votes
3answers
5k views
Load entire NextGEN gallery from single thumbnail?
I'm using Alex Rabe's NextGEN Gallery in a lot of client sites as a centralized image repository, and am finding I often need to load an entire gallery into a lightbox (invoked via a single ...
3
votes
1answer
1k views
How does printf( __( ) ); work?
Today I work through a theme to get a better understanding of WordPress and templating.
I discovered this:
<?php
printf(
__('Designed by %s', 'Anyword'),
'<a ...
3
votes
5answers
1k views
How to rearrange fields in comment_form()
Im using a custom filter to change the fields, but can´t figure out how to change the order of the fields in the comment form.
Desired order:
comment field (first/top)
name
email
website
This is ...
3
votes
1answer
693 views
Is there a way to parse shortcodes in PHP?
Many plugins don't provide a documented way to access their functions from within PHP (e.g. when building a custom theme), but only shortcodes to insert in posts.
Is there a standard way of executing ...
3
votes
2answers
660 views
Modify CSS via Theme Control Panel
Hi to all I'm trying to create an advanced control panel for my first Wordpress template but I'm not able to add a function that I will need.
The function that I'm trying to add is the possibility to ...
3
votes
5answers
3k views
Tools for Converting an Existing Website Design to a WordPress Template?
I know how to do it manually, but is there any tool to help me with that?
3
votes
2answers
107 views
Pass PHP variable to javascript
Is there any possibility to pass some PHP variables in javascript so I can use them later?
Only in single.php.
I heard about wp_enqueue_scripts but with that it is neccesary to declare a path to a JS ...
3
votes
2answers
429 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
2answers
194 views
How to Rename a Template File?
If i have pages that point to somefilename.php and want to change the filename to betterfilename.php, can I leave the template comments unchanged without manually changing all the pages?
/*
Template ...
3
votes
2answers
488 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
4answers
133 views
get page templates
I have this issue where I need to get all page templates. I know there are ways to get them based on their name. I know that I can include a page template but I am trying to include them in the loop ...
3
votes
3answers
341 views
Setting a custom sub-path for blog without using pages?
Warning: fairly pedantic request ahead.
I have a design that makes use of posts (I.e., the blog) and a custom post type called "howto". The site front page ("/") has a template that displays the ...
3
votes
2answers
245 views
Get page IDs based on which template they are using?
I have a situation where I need to provide a dropdown of pages in a widget, based on whether they are using a specific template. In other words, for all pages using template 'Foo', get the post ID.
...
3
votes
3answers
1k views
How to fix a theme with page.php Default Template that accidentally deleted?
I am having a quite odd case with WP today, and after spending about an hour searching on google and forums, can't find any answers. I hope posting here might allow me some chance to get help from ...
3
votes
1answer
2k views
How to make wp-signup.php a 1-step process [closed]
I'm developing a multisite for Real Estate agents. Wp-signup.php used the wrong page template from my theme (homepage instead of full width page template), so I took the meat and potatoes from ...