I have created a custom wordpress archive for Post Categories. It works great. The problem is, I can't figure out how to put a title at the beginning of the page that tells which category the page is for. Here is my Loop Editor content:
[wpv-layout-start]
<h1>Category: [wpv-post-taxonomy type="category" format="name"]</h1>
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
<div class="ddm-episode-entry">
[wpv-post-body view_template="Loop item in Categories"]
</div>
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<p class="ddm-not-found">No posts found in this category.</p>
[/wpv-no-items-found]
[wpv-layout-end]
The <h1> just before the [wpv-items-found] should display the title for the selected category. However, only the word "Category: " appears on the rendered page. How do I get the name of the selected category into the title section?
Great, that worked fine for both my Category Archive and my Tag Archive. However, when I tried to create an Author Archive, that method no longer works. I assume there is a different shortcode for getting the name of the selected author. Could you please tell me what that is?
Also, it would sure be helpful to know what other shortcodes are available, and also to have better searching in your documentation so that I can eventually find those shortcodes for myself.
I don't think this problem was addressed correctly. Actually, the correct answer is to use [wpv-archive-title] for all of these cases--including the author archive page.
The only problem with this method is that it includes the prefix "Category:", "Tag:" or "Author:". The method does not allow for a more general approach.
I think Toolset should look into offering options for the [wpv-archive-title] shortcode.
If you would like to get rid of the “Category:”, “Tag:”, “Author:”, “Archives:” and “Other taxonomy name:” in the archive title, use this little function in your (child) theme functions.php file:
This is definitely helpful, thank you!
However, I wonder if your [wpv-archive-title] shortcode could be modified to take some arguments? Obviously, you already make calls to existing WordPress functions, so this should not be a problem for you from a development standpoint.
I think that your short code could pretty easily be implemented in much the same way that you have done here, except that you should provide an additional argument, $prefix, which defaults to the empty string. Thus your shortcode could be implemented something like this: