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

learn more… | top users | synonyms (1)

8
votes
2answers
756 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?
1
vote
1answer
618 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 ...
1
vote
1answer
517 views

On Taxonomy Template page, want to add Post_Type

I have a custom taxonomy template page in my theme. Essentially, when someone clicks on a term link into this taxonomy, I -ALWAYS- want to add a specific post-type to the query. I'm not entirely ...
1
vote
3answers
1k views

Best approach for loading a sidebar Only if the screen max-width is >900px?

I have been playing around with media queries quite a bit lately and I love the concept. It is so easy to display images or change div floats depending upon what the users screen max-width is. I'm ...
5
votes
3answers
5k 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 ...
2
votes
1answer
576 views

How to set a fall back template for a custom post type in a plugin?

My custom plugin creates a custom post type, and I want to theme my own "single-my_custom_cpt.php" file. However, I want to store it in my plugin folder, and allow that it be over-written in the ...
2
votes
2answers
293 views

Load different template file when condition met?

If I visit a page on my WordPress site, WP goes and determines what template file it should use based on the template hierarchy. If I'm doing some logic checking in the hook init and say my ...
2
votes
2answers
3k views

When calling wp_title(), do you have to create some kind of “title.php” file?

... or does wp_title() already handle the various contexts in your blog? This could clarify for me how I can achieve a reusable index.php file without having all the conditional statements inside it ...
1
vote
3answers
1k views

Global variable set in the template's header.php is unable to echo in footer.php

E.g. I set this in header.php in my template: <?php $postidextra = get_the_ID(); ?> <?php $sidebar_state = get_post_meta($postidextra , 'rw_sidebar_state', true); ?> And I can echo ...
1
vote
3answers
2k views

wordpress - load a template based on the URI

I have a number of custom of post types - i.e. 'windows', 'doors', 'garages' and I want to load a custom template (special.php) whenever my wordpress site has a url that looks like this: ...
0
votes
3answers
234 views

Unable to run jQuery script in my template file

I really want to run a simple code in my template file. E.g. if I put somethign like this in my page.php: <script type="text/javascript"> jQuery(document).ready(function($) { ...
0
votes
1answer
2k views

Two exact templates, sidebar showing in one but not the other

I'm using the Roots WP Theme and for some reason when copy pasting the page-custom.php to create a home page template. The new homepage template is showing the sidebar but not the original page-custom ...
0
votes
1answer
402 views

Custom Page Template [closed]

Could somebody help me make a custom page template? I'd like to have a basic page (with sidebars, header and footers) and a table for data. I'd like the data to be taken from custom fields. ...
4
votes
1answer
1k 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 ...
3
votes
1answer
547 views

I put my blog on a subpage, how do I get page title?

I've got my blog setup on a subpage (not the front page) and I'm using the template file home.php, how can I get the contents from the page editor onto this subpage? If I change the title of the page ...
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 ...
2
votes
1answer
306 views

Sharing templates with the JSON API?

Is there any way to share 'templates' between JS and Wordpress? For instance, this sort of modest seat-of-the-pants templating feels ok: var AJAXSuccessFunc = function(data){ // calling this on ...
2
votes
4answers
2k views

Grid layout “last” class to every third item

Seems like a trivial problem but I can't get it to work. I need to add class="last" to every third post. Here is my code: <?php $count = 0; $my_query = new ...
1
vote
1answer
93 views

How to display a listing template of a certain taxonomy?

I'm trying to figure out how to display a list of specific taxonomy (categorycourses). In functions.php for the theme I have: //Register custom taxonomy for courses-categories $course_cat_args = ...
1
vote
1answer
119 views

Single page template for custom post_type

I registered a custom post type with the following code: #Register custom post type for Stars of the Month add_action( 'init', 'sdp_create_star_type' ); function sdp_create_star_type() { ...
1
vote
1answer
38 views

Can I obtain differents links for different installed theme?

I have to show 3 differents template to a person and then say to him: "Please, choose one of these templates and I will use it for your web site" So the question is: Have I to install 3 differents WP ...
1
vote
1answer
413 views

Mass update excerpt

I'm using a photoblog theme which upon creating a new post it takes the post attachment and saves a modified "img src" string into the excerpt field. It then uses <?php the_excerpt(); ?> to ...
1
vote
1answer
83 views

Template plugin for blog posts? [closed]

can someone recommend a plugin to do the following? My wordpress CMS has two types of users: administrator and editor, both of whom are not technologically savvy, so they need things to be super ...
1
vote
2answers
2k views

display different template based on post type

Hay, i have a custom post type "Events", however this is basically a post type, so it inherits the post.php template page. Is there anyway to use a different template (i.e events.php) if the content ...
0
votes
1answer
31 views

Add pagination to blog

I want to limit 3 blog entry snippets per page and include pagination for additional pages. Here's what I have so far, but pagination isn't working. <div id="page-content"> ...
0
votes
2answers
51 views

Change site template from php

What is the argument to pass to switch theme, when I have the result of wp_get_themes()? $args = array( 'allowed' => true ); $themes = wp_get_themes( ); foreach ($themes as $theme) ...
0
votes
2answers
47 views

Wordpress theme & site not loading after moving files

I was recently created a custom application for wordpress. So while doing so in my file manager (I use the one provided by godaddy(my webhost)), I moved all the files from the [DOCUMENT_ROOT] ... the ...
0
votes
1answer
2k views

How to add a new product type on woocommerce product types? [closed]

I want to add a new custom "product type" to woocommerce plugin: Tried to duplicate one of currently exist product type files (woocommerce template structure) as a new file (file name and inside ...
0
votes
2answers
461 views

index.php template is used instead of blog page

I am trying to set WordPress so that home page is static, and the blog page is a separate page. So, I created two page templates in my theme., lets call them home_template and blog_template. Then, I ...
0
votes
2answers
798 views

Post formats template

I would like to know what template wordpress uses to display post formats archive pages? What is parent template file that is used when there is no specified template file and what is specified ...
0
votes
2answers
38 views

How do you modify Page Template?

Do I just go to Appearance->Editor and then pick the template and modify the PHP code directly, or is there a more "non-coding" way of doing it? I'm using a theme with a contact form, and the whole ...
0
votes
1answer
549 views

comments_template not working correcly in custom template files

In a template file that I am using as page, I want to allow only 2 users to post comments and allow to all other users to only see these comments( not allow them add comments). my template file is: ...
0
votes
2answers
222 views

Prevent private post 404

I want private posts (for those not logged in) to use the single.php template just as public posts do, at the moment they get thrown over to the 404.php template. I've had a good look through the ...
0
votes
1answer
300 views

How to retrieve depth of menu into template

In wp_nav_menu i use for the menu, with custom walker, i can get the $depth parameter in the start_el function function start_el(&$output, $item, $depth, $args) but, outside this ...
0
votes
1answer
536 views

Display different header images based on current page

I want to display, based on the current page another header image. Short example: Home -> Image A PageId 1,2,3,4 -> Image B (2,3,4 are childs of page 1) PageId 5, 6 -> Image C ... I tried to ...
0
votes
1answer
1k views

How to Display an Image Uploaded through a Meta Box in a Template?

I am just learning to create a meta box to upload a file in wp-content/uploads folder through this code: //display image meta box function display_image_box() { global $post; wp_nonce_field( ...
0
votes
2answers
140 views

Using locate-template & shortcodes doesn't appear to work

For organisation, I'm trying to split up the functions.php file into separate files. In particular the functions for shortcodes in a separate file, with the shortcodes being defined in functions.php. ...
0
votes
1answer
1k views

Use template of parent category for single post sub-categories

I have single post templates in a folder in my child theme marked "single". I need the sub categories to use the same template as their parent. I've read a dozen tutorials all of which were more than ...
0
votes
1answer
451 views

Guest author's post not display in author template

I am using this filter to display guest author on post, but i want guest author's posts to appear in the author.php template also. This is my guest author code (inside functions.php). <?php ...
0
votes
1answer
680 views

Stream Video Player does not work with do_shortcode()?

I have downloaded a plugin called Stream Video Player, which has a shortcode. If I put the shortcode into the content editor, it works well and it displays the video. However, if, inside a template I ...
0
votes
2answers
390 views

TwentyTen: Overloading template.php files vs. get_template_part

I'm studying TwentyTen, under the assumption that it contains the best practices for writing themes and modifying them using child themes. I'm noticing what looks like a really redundant practice, ...
0
votes
1answer
750 views

where can I see my custom post type archive template?

I am working with wordpress 3.1 and have custom post type of whitepaper. My single-whitepaper template seems to be working. But the archive template (archive-whitepaper.php) is not. And this after I ...
0
votes
1answer
688 views

Using shortcode in template file

this is shortcode in template: function shortcode_frame_left( $atts, $content = null) { return '<span class="frame alignleft">'. do_shortcode($content) . '</span>'; } ...
-1
votes
1answer
654 views

Template for custom post type shows all posts instead of just one

I wrote a simple plugin to create a custom post type named "people": add_action( 'init', 'create_person' ); function create_person() { register_post_type( 'people', array( ...
-1
votes
1answer
52 views

Same posts within a paginated page

I have a specific template that displays only posts from a category (350). When I paginate my posts, the posts stay the same. Below is some code that makes up this template. Any ideas how to correct ...