I am trying to: show the archive category name above the loop
I visited this URL: hidden link
I expected to see: Hello, this is the 'Photography' category
Instead, I got: Hello, this is the '' category
I've used this code in my views wp archive and its not outputting the category name.
<h1> Hello, this is the '[wpv-post-taxonomy type='category' format='name']' category</h1>
It seems a simple thing to do but its not displaying correctly.
Can you help?
Thanks
Cathie.
Here is the full code of the archive and you can see that I've put the archive title outside the Views Loop
[wpv-layout-start]
<h1> Hello, this is the '[wpv-post-taxonomy type='category' format='name']' category</h1>
[wpv-items-found]
<h2>[wpv-post-taxonomy type='category']</h2>
<!-- wpv-loop-start -->
<wpv-loop>
<div class="blogpost">
<h1>[wpv-post-link]</h1>
[wpv-post-featured-image class="image-left"]
[wpv-post-excerpt length='80' count='word' class='excerpt-right'] ... <a href="[wpv-post-url]">read more</a>.
<div>Date: [wpv-post-date format='d M Y']
</div>
</div>
<div class="clearboth"></div>
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
Minesh
Supporter
Languages:
Englisch (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Hello. Thank you for contacting the Toolset support.
Could you please try to add following shortcode to your current theme's functions.php file:
add_shortcode('wpv-archive-title', 'wpv_archive_title_func');
function wpv_archive_title_func($atts, $content){
$x = split(":",get_the_archive_title());
$x = $x[count($x)-1];
return $x;
}
Call the shortcode, for example:
<h1> Hello, this is the '[wpv-archive-title]' category</h1>
I hope this solution will help you to resolve your issue.
Thank you, I appreciate your help and the solution. 🙂