Within the context of WordPress Theme-ing, the term 'template' refers to PHP files used to display content.

learn more… | top users | synonyms (1)

3
votes
1answer
2k 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 ...
23
votes
9answers
22k 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 ...
22
votes
1answer
11k views

Create custom page templates with plugins?

Is it possible to make custom page templates available from a plugin?
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?
34
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. ...
11
votes
4answers
4k 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 ...
2
votes
1answer
1k views

How to quickly switch custom post type singular template?

I have a custom post type called movies and I need to quickly switch the template that displays the movies cpt on the front end via a link. How can this be done? Files I have: single-movies.php ...
6
votes
5answers
2k 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 ...
6
votes
3answers
11k 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 ...
7
votes
2answers
1k 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: ...
2
votes
1answer
1k views

Is it possible to define a template for a custom post type within a plugin independent of the active theme?

I'm writing a plugin to manage data about open-source projects. I developed an object model and have successfully created all custom post types and taxonomies, as well as implemented the correct ...
2
votes
1answer
742 views

Custom Taxonomy in plugin and template

I have a plugin that I am developing that is using custom post types and taxonomies. My question is this. How can I load the content/theme data from my plugin on to the page when the go to the custom ...
0
votes
3answers
4k views

Page template query with WP_Query

I'd like to query only pages with a certain page template with WP_Query or a function that would return the post object, but I can't find any information about that on the officiel codex.
2
votes
1answer
3k views

How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy

This answer provides the code for a query that returns an OR match on a taxonomy term: global $query_string; $args['tax_query'] = array( array( 'taxonomy' => 'status' ,'terms' ...
10
votes
1answer
9k 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, ...
4
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 ...
3
votes
2answers
780 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 ...
1
vote
2answers
2k views

How can I make all subcategories use the template of its category parent?

(Satisfying minimum text requirement)
0
votes
1answer
1k views

New Template — copy existing template and change code? [duplicate]

Possible Duplicate: Correct process for a new Page Template? I created a page template following these instructions: http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates I'm ...
-1
votes
1answer
4k views

How did you incorporate WooCommerce in your own WordPress theme?

This has most probably been asked before, but I really need to show WooCommerce products in my template, but I don't know what hooks to add where. It's my first time working with WooCommerce. Can ...
17
votes
1answer
26k 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 ...
3
votes
2answers
516 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
4answers
3k views

How to check if a shortcode exists?

I'm using do_shortcode function to add shortcode in my template. But i would like to check if that shortcode exists before display them. I mean like this If (shortcode_gallery_exists) { echo ...
2
votes
2answers
621 views

Create built-in pages without creating actual pages

For example: site.com/contact (or site.com/?page=contact if not using permalinks) when someone goes to that page I want to load a theme template, like page-contact.php But I don't want to create a ...
5
votes
4answers
5k 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
5answers
369 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
2answers
694 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 ...
3
votes
3answers
2k views

Loading template files from a subfolder in my theme?

I am working on a site that will have up to 30 templates in it. I don't want to have all those templates at the root of my theme folder cluttering up everything. I know how I can modify the ...
2
votes
1answer
291 views

Hide page visual editor if template is selected - redux

The answer given to a previous and identical question is unfortunately not working on my WP install. I'm using a version of the function recommended there. function nim_hide_editor() { $post_id ...
2
votes
1answer
404 views

Outputting Canonical Resource URLs Across a Multisite Network?

Say a theme "foo" is used on across a network of sites. In each site, all the theme resources (.css, .js, etc.) will have distinct URLs: http://network/siteA/wp-content/themes/foo/style.css ...
1
vote
3answers
729 views

Programmatically change post templates?

I need to change the template on several hundred pages on my site. Does anyone know if there is a command to do it programmatically? See the following code snippet; I'd like to replace my comment ...
1
vote
2answers
964 views

A shared custom taxonomy between two custom post types

I have two custom post types: event and contact: http://acicafoc.josoroma.com/contactenos http://acicafoc.josoroma.com/eventos Both of them uses a custom taxonomy: country I just created a ...
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
3k 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 ...
2
votes
3answers
1k views

Change page template programmatically ?

I have two page templates and Qtranslate installed. I want to choose one or another depending the language selected. Can I do something like this ? if($q_config['lang'] == 'en'){ // load ...
1
vote
3answers
150 views

Single page theme

I am trying to create single page theme. What i have trouble with is understanding this whole wordpress query logic. There is query object and supposedly i get all published posts like this: ...
0
votes
2answers
68 views

Forcing oembeds to top of post

What's the best way to force oembed (or shortcodes too) to the top of a post? I'd like to feature youtube embeds before the actual article content, regardless of where the link was inserted. Any ...
0
votes
0answers
173 views

Why won't the action hook wp_head won't accept parameters?

I'm working on a plugin that adds scripting to the head using add_action('wp_head',..); I have to pass a variable to the function to get my desired result. To test this I'm simple "echoing" out the ...
0
votes
2answers
470 views

Remove navigation from header in custom page template

I'm building a landing page and want to remove the navigation menu from the page. The navigation menu is in header.php which is of course in the page template. Is there a WordPress function I can use ...
0
votes
2answers
97 views

Correct process for a new Page Template?

I'm creating a new Page Template. I want to change margins, fonts, font sizes, and things like that. I don't know if I've done things right. Is the following process that I've followed sound?: I ...
0
votes
3answers
448 views

Custom Post Type Archive Template

I have similar problem to this one: Custom Post Type Template - Archive I have a WordPress custom post type called coupon. I try to assign the template to it by using archive-coupon.php, but it goes ...
-1
votes
2answers
409 views

stop blog page from using index.php?

I have a static homepage with a custom template I.E hompage.php the blog loop is set to a static page named blogg, it uses the index.php page as a template, there a collection of other pages using the ...
11
votes
3answers
9k 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' => ...
11
votes
2answers
5k 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?
3
votes
3answers
794 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 ...
1
vote
1answer
2k views

tag.php doesn't work with tags on a custom post type post?

here's another stumper. I have a tag.php page. It works fine, unless you click a tag that is in a post associated with a custom post type. Then it doesn't work. Its like that tag, doesn't exist. But ...
8
votes
2answers
639 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?
2
votes
5answers
876 views

How to force TinyMCE in WodPress to replace newlines with <br> tags and not with <p>&nbsp;</p>

TinyMCE editor inserts <p>&nbsp;</p> instead of <br> tags when I press enter in my text for a new line. How to force TinyMCE in WP to replace newlines with <br> and not ...
2
votes
3answers
3k views

Hide page visual editor if certain template is selected?

How do I hide the page editor (WYSIWYG editor) if the current page is set to a certain template. I have the following code already to add in custom meta boxes when certain templates are chosen: ...
1
vote
1answer
430 views

Passing variables to templates (alternatives to globalizing variables)

I want to make my WP code simpler (there's some mess within header.php, page.php etc.). So, for example, I want to set something like this global: $foo = get_option('foo'); So $foo will work ...