![]() |
Example:
PHP
add_action('wp_head', 'show_template');
function show_template() {
global $template;
print_r($template);
}
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div id="post-4" class="post-4 post type-post hentry category-uncategorized category-test category-test-1-billion category-test2 category-test3 category-testing">
// Slice crazy long div outputs
function category_id_class($classes) {
global $post;
foreach((get_the_category($post->ID)) as $category)
$classes[] = $category->category_nicename;
return array_slice($classes, 0,5);
}
add_filter('post_class', 'category_id_class');
<div id="post-4" class="post-4 post type-post hentry category-uncategorized">
How to Output which theme template file a post/page is using in the header | Wordpress Header Footer Shortcode |
Method-1: Output which theme template file a post/page is using in the header | Wordpress Header Footer Shortcode |
then | Wordpress Header Footer Shortcode |
Read Full: | Wordpress Header Footer Shortcode |
Category: | Web Tutorial |
Sub Category: | Wordpress Header Footer Shortcode |
Uploaded: | 1 year ago |
Uploaded by: | Admin |
Views: | 53 |