Linked Questions

69 votes
9 answers
141k 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 ...
Average Joe's user avatar
  • 1,869
10 votes
4 answers
10k views

Best way to detect if you are in a SINGLE POST page

So this may seem like a pretty menial thing, but follow me here. I'm trying to add some logic through the pre_get_posts action. This is the entire WP_Query object given to me. (see the end) Things I ...
Eric Holmes's user avatar
  • 3,901
9 votes
4 answers
3k views

Is there a variable for a template parts name?

One you have called a template with get_template_part() (or locate_template()) is there a way to know what template you are in. For example if you call get_template_part('loop','archive'); from ...
helgatheviking's user avatar
5 votes
3 answers
1k views

Is there a hook or function I can use to display all theme files being used on a current page?

Basically I want to be able to see the names of files on the front-end - not just templates e.g. category/page templates, but the actual theme files like header.php/sidebar.php/footer.php and so on. ...
RachieVee's user avatar
  • 830
3 votes
4 answers
7k views

How can I see what template parts are being called for rendering the viewable page?

I have a theme where the developer used get_tempalate_part() a lot, and these parts are scattered across theme subdirectories as well as in directories in a plugin that was created to assist with the ...
user658182's user avatar
0 votes
4 answers
17k views

How to use if (is_page_template (''))

i use the following code in my functions.php. I want to exclude all pages which use the single.php template. function cat_menu() { if (!is_page_template('single.php')) { $cur_cat = get_query_var('...
tom84's user avatar
  • 255
2 votes
3 answers
3k views

Add parent template name to body class filter when visiting subpage or single post

how would I go about creating a filter for the body_class() tag that allows me to add the the parent pages slug name as a class to the body whenever visiting a subpage or post?
Mr.Brown's user avatar
  • 1,015
0 votes
1 answer
3k views

Why get_page_template() doesn't show taxonomy template file name?

I made a custom taxonomy called - work-category and a template file for it called - taxonomy-work-category.php. That part work just fine. For a purpose I did put get_page_template() in that taxonomy-...
Aajahid's user avatar
  • 103
1 vote
2 answers
1k views

How to identify which template WordPress's default search-form retrieves in my theme

I have a problem with the style of my search page, and I'd like to fix it. However, I'm not sure which template I need to modify. How do I find out which template is being called by my theme when I ...
CoderScissorhands's user avatar
0 votes
1 answer
461 views

Force WordPress to NOT display the manual excerpt

I'm forced to use manual excerpts on a number of my posts to integrate them with a shortcode plugin. However, this is interfering with how they're being displayed on an archive page (using a page ...
daysrunaway's user avatar
0 votes
2 answers
180 views

What is the best way to figure out which template file that a "pretty permalink" is using?

I'm new at wordpress, so maybe this question is very basic, but I looked at Google and I searched for tutorials and I didn't find anything... The question is simple. I have a "page", and this page is ...
Nisanio's user avatar
  • 153
0 votes
1 answer
66 views

Is there a way to retrieve the calling template part?

If I include a template part within header.php like this: <?php get_template_part('templates/social-icons'); ?> Is there a way to retrieve the template name header.php within this template ...
codecowboy's user avatar
  • 1,758
0 votes
1 answer
63 views

Strange Behavior of Page Template Dropdown

My wordpress is updated to latest version 3.4.1 and I noticed a strange function of it - in the Page attributes block page template dropdown has the value: (.*)\n)siU",$template_contents,$...
jam's user avatar
  • 183