The Stack Overflow podcast is back! Listen to an interview with our new CEO.
4 Add basename() to get the template name, not the whole path as [Privateer](http://wordpress.stackexchange.com/users/66020/privateer) suggests
source | link

In your wp_query loop you'll want to check the page template of the current post object. You'll be able to set that to a string and use it however you want

Close to this:

while ( $query->have_posts() ) : $query->the_post(); 
if (is_page) {
  $pageTemplate = basename( get_page_template() );
  echo "<p class=\"" . $pageTemplate . "\">" . get_the_title() . "</p>";
}
endwhile;

Refer to the codex page for more info on the function

In your wp_query loop you'll want to check the page template of the current post object. You'll be able to set that to a string and use it however you want

Close to this:

while ( $query->have_posts() ) : $query->the_post(); 
if (is_page) {
  $pageTemplate = get_page_template();
  echo "<p class=\"" . $pageTemplate . "\">" . get_the_title() . "</p>";
}
endwhile;

Refer to the codex page for more info on the function

In your wp_query loop you'll want to check the page template of the current post object. You'll be able to set that to a string and use it however you want

Close to this:

while ( $query->have_posts() ) : $query->the_post(); 
if (is_page) {
  $pageTemplate = basename( get_page_template() );
  echo "<p class=\"" . $pageTemplate . "\">" . get_the_title() . "</p>";
}
endwhile;

Refer to the codex page for more info on the function

3 code formating..
source | link

In your wp_query loop you'll want to check the page template of the current post object. You'll be able to set that to a string and use it however you want

Close to this:

while ( $query->have_posts() ) : $query->the_post(); 
if (is_page) {
  $pageTemplate = get_page_template();
  echo "<p class=\"" . $pageTemplate . "\">" . get_the_title() . "</p>";
}
endwhile;

Refer to the codex page for more info on the function

Hope that helps!

In your wp_query loop you'll want to check the page template of the current post object. You'll be able to set that to a string and use it however you want

Close to this:

while ( $query->have_posts() ) : $query->the_post(); 
if (is_page) {
  $pageTemplate = get_page_template();
  echo "<p class=\"" . $pageTemplate . "\">" . get_the_title() . "</p>";
}
endwhile;

Refer to the codex page for more info on the function

Hope that helps!

In your wp_query loop you'll want to check the page template of the current post object. You'll be able to set that to a string and use it however you want

Close to this:

while ( $query->have_posts() ) : $query->the_post(); 
if (is_page) {
  $pageTemplate = get_page_template();
  echo "<p class=\"" . $pageTemplate . "\">" . get_the_title() . "</p>";
}
endwhile;

Refer to the codex page for more info on the function

2 code formating..
source | link

In your wp_query loop you'll want to check the page template of the current post object. You'll be able to set that to a string and use it however you want

Close to this:

while ( $query->have_posts() ) : $query->the_post(); 
if (is_page) {
  $pageTemplate = get_page_template();
  echo "<p class=\"" . $pageTemplate . "\">" . get_the_title() . "</p>";
}
endwhile;

Refer to the codex page for more info on the function

Hope that helps!

In your wp_query loop you'll want to check the page template of the current post object. You'll be able to set that to a string and use it however you want

Close to this:

while ( $query->have_posts() ) : $query->the_post(); 
if (is_page) {
  $pageTemplate = get_page_template();
  echo "<p class=\"" . $pageTemplate . "\">" . get_the_title() . "</p>";
}
endwhile;

Refer to the codex page for more info on the function

Hope that helps!

In your wp_query loop you'll want to check the page template of the current post object. You'll be able to set that to a string and use it however you want

Close to this:

while ( $query->have_posts() ) : $query->the_post(); 
if (is_page) {
  $pageTemplate = get_page_template();
  echo "<p class=\"" . $pageTemplate . "\">" . get_the_title() . "</p>";
}
endwhile;

Refer to the codex page for more info on the function

Hope that helps!

1
source | link