I'm trying to create a View that's limited to a certain number of blog posts, and if there are more blog posts in that category than the limit, I want to show a link to all blog posts in that category.
Here is an example (scroll to the bottom): hidden link
Where it says "Related Posts".
Here is the category view: hidden link
Here is the nested view with the individual posts: hidden link (right now not limited to any number of posts but I would limit it to 3 or 5)
Example (in this example, category A has 20 posts, category B has 3 posts):
"Related Posts: Category A
- post 1
- post 2
- post 3
see all posts in Category A
"Related Posts: Category B
- post 1
- post 2
- post 3"
Can you suggest a way to accomplish this?
Thanks!
Hello,
Please provide your website credentials in below private message box, I need to check your website settings, thanks
Thanks for the details, I have done below modifications in your website:
1) Edit parent taxonomy view:
hidden link
in section "Loop item in Related Categories 2 for Post Page", add attribute "term_slug" to the view's shortcode, pass term slug to child post view:
[wpv-view name="posts-for-individual-category-groups-view" term_slug="[wpv-taxonomy-slug]"]
2) Edit the child post view:
in section "Pagination and Sliders Settings":
hidden link
- enable option "Pagination enabled with manual transition and page reload"
- Display 3 items per page
in section "Loop Editor", add line 10:
[wpv-pagination]<a href="<em><u>hidden link</u></em> name="term_slug"]">Show more link here ...</a>[/wpv-pagination]
It will check if there is pagination(more than 3 posts), then display a term archive page link
Please check if it is what you want.
More help:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-pagination
This shortcode displays the pagination controls. The pagination controls will only be displayed if there are multiple pages to display.
Woohoo, this was exactly what I was hoping for! And I would have never been able to figure it out on my own. Thank you so much!!
Thank you so much, Luo, I learned a lot about passing through information to the child View, I had no idea how to do that!
I know you guys don't normally help with styling, but I'm trying to get that "see all posts" link up under the
items (but aligned to the left of the page) so that it shows that the "see more" link is related to those posts. I tried several styling ideas but couldn't get it to work. Any suggestions?
Thank you!
Liat
Dear Liat,
I have checked the URL you mentioned above again:
hidden link
It seems that you have already fixed it with CSS codes, is this problem resolved? please let me know if you need more assistance for it.
Luo
I could not get the words to left-align. They are indented and get lost with the rest of the list. I was trying some ideas to get the line to left-align to the page but it didn't work. Any suggestions? Thank you!!
You can try one of below two options:
1) move those codes outside HTML UL tag, for example, edit the child post view:
hidden link
Modify line 9~10, from:
</ul>
<div style="padding-left: -1 em;">[wpv-pagination]<a href="/knitting-topic/[wpv-attribute name="term_slug"]">See all [wpv-attribute name="term_name"] posts here</a>[/wpv-pagination]</div>
To:
<div style="padding-left: -1 em;">[wpv-pagination]<a href="/knitting-topic/[wpv-attribute name="term_slug"]">See all [wpv-attribute name="term_name"] posts here</a>[/wpv-pagination]</div>
</ul>
2) Use CSS codes, for example:
<div style="padding-left: -1 em; margin-left: -1em;">
hidden link
My issue is resolved now. Thank you!
I removed the