<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>current_theme_template Archives - Nicholas Rowe</title>
	<atom:link href="https://www.nicholas-rowe.com/tag/current_theme_template/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.nicholas-rowe.com/tag/current_theme_template/</link>
	<description>CEO &#38; Co-Founder - Saigon Digital</description>
	<lastBuildDate>Mon, 17 Nov 2014 18:02:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.nicholas-rowe.com/wp-content/uploads/2025/12/cropped-nick-whitebg-e1765901896660-32x32.png</url>
	<title>current_theme_template Archives - Nicholas Rowe</title>
	<link>https://www.nicholas-rowe.com/tag/current_theme_template/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Find out what template a WordPress theme is using.</title>
		<link>https://www.nicholas-rowe.com/find-out-what-template-a-wordpress-theme-is-using/</link>
					<comments>https://www.nicholas-rowe.com/find-out-what-template-a-wordpress-theme-is-using/#respond</comments>
		
		<dc:creator><![CDATA[Nicholas Rowe]]></dc:creator>
		<pubDate>Thu, 07 Feb 2013 15:59:35 +0000</pubDate>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Wordpress Theming]]></category>
		<category><![CDATA[current_theme_template]]></category>
		<guid isPermaLink="false">http://nicholas-rowe.com/?p=198</guid>

					<description><![CDATA[<p>Recently I was working on a clients website and it was decided that I was going to integrate buddypress on the website. I have worked with buddypress in the past and found it a great bit of software to extend upon with WordPress. This time round it was a bit more of a overall custom feel [&#8230;]</p>
<p>The post <a href="https://www.nicholas-rowe.com/find-out-what-template-a-wordpress-theme-is-using/">Find out what template a WordPress theme is using.</a> appeared first on <a href="https://www.nicholas-rowe.com">Nicholas Rowe</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Recently I was working on a clients website and it was decided that I was going to integrate <a href="http://buddypress.org/">buddypress</a> on the website. I have worked with buddypress in the past and found it a great bit of software to extend upon with WordPress. This time round it was a bit more of a overall custom feel to it and some extra theming was required.</p>
<p>Some of the buddypress pages used different templates and I found it misleading sometimes as to which pages where using which templates. I found a great little bit of code that will show only the administrator who is logged in which template the current page is using. Great for debugging and other little things.</p>
<p>First of all we need to register a new little function, with which we will be using a global var. Put this in to your themes functions.php file.</p>
<pre>add_filter( 'template_include', 'var_template_include', 1000 );
function var_template_include( $t ){
$GLOBALS['current_theme_template'] = basename($t);
return $t;
}

function get_current_template( $echo = false ) {
if( !isset( $GLOBALS['current_theme_template'] ) )
return false;
if( $echo )
echo $GLOBALS['current_theme_template'];
else
return $GLOBALS['current_theme_template'];
}</pre>
<p>Once we have registered our new function, we will want to call it in our theme files somewhere. I simply added the below snippet to my header.php file of my theme. This code will print out the current page template by using the function we registered before.</p>
<pre>// If the current user can manage options(ie. an admin)
if( current_user_can( &#039;manage_options&#039; ) )
// Print the saved global
printf( &#039;
&lt;div&gt;&lt;strong&gt;Current template:&lt;/strong&gt; %s&lt;/div&gt;
&#039;, get_current_template() );
?&amp;gt;</pre>
<p>So there you have it, if you ever get stuck needing to find out what page is using what template (great for plugins) you can use this.</p>
<p>Edit: I also found this little snippet and it can be used in the same manner:</p>
<pre>
add_action('wp_head', 'show_template');
function show_template() {
global $template;
print_r($template);
}</pre>
<p>The post <a href="https://www.nicholas-rowe.com/find-out-what-template-a-wordpress-theme-is-using/">Find out what template a WordPress theme is using.</a> appeared first on <a href="https://www.nicholas-rowe.com">Nicholas Rowe</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.nicholas-rowe.com/find-out-what-template-a-wordpress-theme-is-using/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
