Hi,
I have hundreds of pages to create.I use CSV to create them in bulk.
Each page is titled the same as a taxonomy term. (for example, a page called: Guitar, is corresponding to a category called "Guitar")
Each page is used to display the posts of that taxonomy term.
I am trying to create a view that takes the page title automatically and shows the posts that has the taxonomy that is equal to that page title.
so for example:
instead of me adding this view to each of the hundreds of pages, and replace xxxx with the category name:
[wpv-view name="view-name" wpvcategory="xxxx"]
I want to end up with something like:
[wpv-view name="view-name" wpvcategory="{page_title}"]
so if the page is titles "guitar", the result is a grid of posts that are under category "guitar"..etc
thanks
Hi,
I created a view that shows "posts" and chose to use the argument in the shortcode method.
I tried the following variations, none of them worked:
[wpv-view name="automatic results 1" wpvcategory="[wpv-post-title]"]
[wpv-view name="automatic results 1" wpvcategory="wpv-post-title"]
[wpv-view name="automatic results 1" wpvcategory=[wpv-post-title]]
[wpv-view name="automatic results 1" wpvcategory="[wpv-post-title output='raw']"]
[wpv-view name="automatic results 1" wpvcategory="wpv-post-title" output='raw']
[wpv-view name="automatic results 1" wpvcategory=[wpv-post-title output='raw']]
[wpv-view name="automatic results 1" wpvcategory="[wpv-post-title output="raw"]"]
[wpv-view name="automatic results 1" wpvcategory="wpv-post-title" output="raw"]
[wpv-view name="automatic results 1" wpvcategory=[wpv-post-title output="raw"]]
[wpv-view name="automatic results 1" wpvcategory="[wpv-post-title output=raw]"]
[wpv-view name="automatic results 1" wpvcategory="wpv-post-title" output=raw]
[wpv-view name="automatic results 1" wpvcategory=[wpv-post-title output=raw]]
[wpv-view name="automatic results 1" wpvcategory="[wpv-post-title output='sanitize']"]
[wpv-view name="automatic results 1" wpvcategory="wpv-post-title" output='sanitize']
[wpv-view name="automatic results 1" wpvcategory=[wpv-post-title output='sanitize']]
[wpv-view name="automatic results 1" wpvcategory="[wpv-post-title output="sanitize"]"]
[wpv-view name="automatic results 1" wpvcategory="wpv-post-title" output="sanitize"]
[wpv-view name="automatic results 1" wpvcategory=[wpv-post-title output="sanitize"]]
[wpv-view name="automatic results 1" wpvcategory="[wpv-post-title output=sanitize]"]
[wpv-view name="automatic results 1" wpvcategory="wpv-post-title" output=sanitize]
[wpv-view name="automatic results 1" wpvcategory=[wpv-post-title output=sanitize]]
Each page is used to display the posts of that taxonomy term.
You know this is exactly what WordPress Archives are designed to do, right? Term archives are built into WordPress and you do not need to create separate custom Pages with Views for each term. If you're aware of that, and need to use Pages for some specific reason, that's fine, I just wanted to make sure you're aware that you may be creating a lot of extra work for yourself using this approach.
If you want to use the current Page's post title in a shortcode, I suggest you use the wpv-post-title shortcode with the $current_page operator in its id attribute:
[wpv-post-title id='$current_page']
[wpv-view name="automatic results 1" wpvcategory="[wpv-post-title id='$current_page']"]
But it seems like you would use the post slug, since it would be uncapitalized and sanitized. As long as the page slug matches the term slug, this should work:
[wpv-view name="view-name" wpvcategory="[wpv-post-slug id='$current_page']"]
Hi Christian,
thanks for your comprehensive response. Yes I know that this is the role of the archive pages. however, I have multiple categories, each category needs a totally different layout, therefore using archives is not the optimum solution for me.
however, your solution works perfectly with me.
much appreciated.
Hi Christian,
Following on from my question before.
Now I have a CPT called "sermons", and a custom taxonomy called "Series".
some sermons will be individual posts, and some sermons will be grouped under the "series" taxonomy. (e..g a series about the book of Genesis, can have 5 posts, all have the custom taxonomy "Genesis").
I will create a post (from the same sermons CPT) for the series. the post title will be identical to the series name. however, slug will not be identical as slug is governed by the 256 characters, and the Arabic characters get encoded in the slug).
I want to create a view that takes the post title and use it automatically to create a view of the sermon posts that have this taxonomy term.
The code I used doesn't give anything. I have the code wrapped in a conditional, but even without the conditional, it still doesn't give any results.
here are the code variation I tried:
[wpv-conditional if="( '[wpv-post-type]' eq 'sermon' ) AND ( $(wpcf-is-this-a-series) eq '1' )"]
[wpv-view name="series-view" wpvseries="[wpv-post-title]"]
[/wpv-conditional]
[wpv-conditional if="( '[wpv-post-type]' eq 'sermon' ) AND ( $(wpcf-is-this-a-series) eq '1' )"]
[wpv-view name="series-view" wpvseries="[wpv-post-title id='$current_page']"]
[/wpv-conditional]
Here is the result, an empty page:
hidden link
while if I used the post title directly, th e correct posts (2 posts) show. so the view itself works:
hidden link
can you please help me identifying why my codes don't work?
thanks in advance