- This topic has 7 replies, 2 voices, and was last updated 4 years, 8 months ago by
Elvin.
-
AuthorPosts
-
August 8, 2021 at 7:33 pm #1888589
Trần
I have a question maybe relate with this post:
How can I creat a category of Archive for my website https://kimquy.com.vn/blog/ like that webste: https://www.ultimatebeaver.com/modules/advanced-posts/example-4/
It displays some category of blog with a beautifull style
All Creative Fashion Outdoor PortraitsI don’t need to custom display for blogs in Archive Blog.
I need add a category for Archive Pages: List of all category blog.
How can I do?August 8, 2021 at 8:28 pm #1888612Elvin
StaffCustomer SupportHi there,
to clarify: You’re trying to make a page that lists posts with interactive button filters?
If so, I’m afraid GP doesn’t have this feature.
You’ll need a third-party plugin to run something like this on your site. 😀
Or if you’re familiar w/ scripting, consider implementing filterizr.
https://yiotis.net/filterizr/#/August 8, 2021 at 10:01 pm #1888661Trần
I just only want to use anchor instest of interactive button filters. How can I do?
August 8, 2021 at 11:23 pm #1888697Elvin
StaffCustomer SupportDid you mean these buttons but without the dynamically changing post list? https://share.getcloudapp.com/6quYWrEW
So basically just pure wp_list_categories()?
We can turn that into a shortcode.
Example:
function getCategoryList() { echo"<ul>"; wp_list_categories('orderby=name&show_count=1&title_li='); echo"</ul>"; } add_shortcode('mycatelist', 'getCategoryList');You then use the shortcode [mycatelist] using the shortcode block. You may have to manually style the list though.
Here’s a good article about it – https://www.codexpedia.com/wordpress/how-to-create-shortcode-in-wordpress/
August 10, 2021 at 1:15 am #1890218Trần
Thank you for your support.
I used other solution (use Elements in GP Premium):<?php $categories = get_categories(); foreach($categories as $category) { echo '<a class="read-more button" href="' . get_category_link($category->term_id) . '">' . $category->name . '</a> '; } ?>And Display rules: Blog and all Archive. But I found, my shop (woocommerce and category in woocommerce is affected too)
So I add a litle check:<?php if(get_post_type()=='post'){ $categories = get_categories(); foreach($categories as $category) { echo '<a class="read-more button" href="' . get_category_link($category->term_id) . '">' . $category->name . '</a> '; } } ?>It works quite well on mobile and desktop.
https://kimquy.com.vn/blog/August 10, 2021 at 1:45 am #1890245Elvin
StaffCustomer SupportAh yes that should work as well.
And that may be better actually. Because you can change the tags used and customize attributes better.
Thanks for sharing it with us.
August 10, 2021 at 1:58 am #1890260Trần
And can use the inheritance class of GeneratePress: read-more button.
Hope it can help some one!
Thanks!August 10, 2021 at 5:11 pm #1891276Elvin
StaffCustomer SupportNo problem. 😀
-
AuthorPosts
- You must be logged in to reply to this topic.