RichardR Posted November 6 Posted November 6 Site URL: https://www.probation-institute.org/the-griffins-society-research-listings Hi everyone, We've been asked to host around 65 research listings from another website that's shutting down and I'd be grateful for some advice please - https://www.thegriffinssociety.org/our-research/our-research-listings The page on our website is here: https://www.probation-institute.org/the-griffins-society-research-listings I've done the page with an unlinked blog page and two summary blocks on there so far (as I know they can only take 30 in each). I've done it this way so I can replicate the layout and format of the original site where I can - as I don't know if this is possible in the blog page. I have some specific questions as follows: I've added an archive filter list down the side, how do I pull in categories/tags from both summary blocks? If that's not possible is there a better way? When you click on one of the filters, for example Probation, it filters but takes you to the unlinked 'blog' page rather than staying on the listings page and just filtering out the ones that don't match. Any way to change this? I'm sure I'm probably doing some things wrong and maybe there's a better way to achieve what I need, so I'd really welcome any advice. Thank you, Richard
DPruitt Posted November 7 Posted November 7 You can use the Universal Filter (affiliate) to achieve more than 30, along with other functionality. RichardR and melody495 2
RichardR Posted November 7 Author Posted November 7 Thank you, I have seen that but wondered if there were other options.
RichardR Posted November 9 Author Posted November 9 Any thoughts on this @tuanphan? Very grateful for any advice.
tuanphan Posted November 12 Posted November 12 On 11/9/2024 at 6:49 PM, RichardR said: Any thoughts on this @tuanphan? Very grateful for any advice. Last month I helped a site with similar filter on Summary Block without using plugin, However, it has one disadvantage: when you need to add a new category filter, you will need to update the code. If you still want this, I can give you a quick guide RichardR 1 Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
RichardR Posted November 12 Author Posted November 12 (edited) 5 hours ago, tuanphan said: Last month I helped a site with similar filter on Summary Block without using plugin, However, it has one disadvantage: when you need to add a new category filter, you will need to update the code. If you still want this, I can give you a quick guide Yes please. That would be amazing thank you, Edited November 12 by RichardR
RichardR Posted November 14 Author Posted November 14 (edited) Hi @tuanphan be great if you have time to share a guide for the filter please. Will it work with 2 or 3 summary blocks as I'll need to add multiple? Many thanks. Edited November 14 by RichardR
RichardR Posted November 16 Author Posted November 16 (edited) hey @tuanphan I think I'm getting there a little. I managed to link two summary blocks, as per your post below: It links the two summer block on the page but when you click on the last post from the first blog, 'Time to Listen', 'Lost Spaces' doesn't appear as the next blog post. So it's linking them on the page, but not when you click through. Also, the archive block doesn't pull in tags from both summary blocks, only the first one. Finally, what would the code be to link 3 summary blocks? Any help really appreciated. Edited November 16 by RichardR
tuanphan Posted November 19 Posted November 19 On 11/15/2024 at 4:36 AM, RichardR said: Hi @tuanphan be great if you have time to share a guide for the filter please. Will it work with 2 or 3 summary blocks as I'll need to add multiple? Many thanks. The code has some problems, I'm trying to fix it, I'll send you a guide early this week RichardR 1 Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
RichardR Posted November 19 Author Posted November 19 Thanks so much @tuanphan I really appreciate it.
tuanphan Posted November 30 Posted November 30 You can follow this to add Filter Category to Summary Block Summary has a limit of 30 items, you can use this to combine 2 or more Summary Blocks together RichardR 1 Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
RichardR Posted November 30 Author Posted November 30 Thanks so much @tuanphan I really appreciate this. Not sure if I've followed correctly as it's not working. Still playing around with it.
RichardR Posted November 30 Author Posted November 30 (edited) Hey @tuanphan, I've tried this with one category to see where I'm going wrong and just can't quite figure it out. At the moment clicking on relationships in the code block links to the relationship category but doesn't segment the blog posts. If I click on relationships in pink above one of the posts, it takes it to the wrong page. Ideally, the categories shown in pink I'd like not to be visible if possible. Really grateful for your help. What I've inserted below. Code block <h5 class="blog-custom-filter"> <span style="line-height:2em;"> <a href="?category=All" class="active">ALL</a> <br> <a href="?category=Relationships" target="_self">Relationships</a> </span> </h5> Code injection on page <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script> $(document).ready(function () { // Map categories in filter to their corresponding summary-item URLs const categoryMap = { '#Relationships': [‘?category=Relationships’] }; // Handle click events on links in .blog-custom-filter $('.blog-custom-filter a').on('click', function (e) { e.preventDefault(); // Prevent default behavior of the link // Remove the 'active' class from all links and add it to the clicked link $('.blog-custom-filter a').removeClass('active'); $(this).addClass('active'); // Get the category from the href of the clicked link let category = $(this).attr('href'); if (category === '#all') { // Show all summary-item elements if 'ALL' is clicked $('.summary-item').show(); } else if (categoryMap[category]) { // Hide all summary-item elements $('.summary-item').hide(); // Show only summary-item elements containing the matching category link $('.summary-item').filter(function () { // Check for both URL formats return categoryMap[category].some(cat => { return $(this).find(`a[href="/blog?category=${cat}"], a[href="/blog/?category=${cat}"]`).length > 0; }); }).show(); } }); }); </script> Edited November 30 by RichardR
tuanphan Posted Wednesday at 09:48 AM Posted Wednesday at 09:48 AM On 11/30/2024 at 11:55 PM, RichardR said: Hey @tuanphan, I've tried this with one category to see where I'm going wrong and just can't quite figure it out. At the moment clicking on relationships in the code block links to the relationship category but doesn't segment the blog posts. If I click on relationships in pink above one of the posts, it takes it to the wrong page. Ideally, the categories shown in pink I'd like not to be visible if possible. Really grateful for your help. What I've inserted below. Code block <h5 class="blog-custom-filter"> <span style="line-height:2em;"> <a href="?category=All" class="active">ALL</a> <br> <a href="?category=Relationships" target="_self">Relationships</a> </span> </h5> Code injection on page <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script> $(document).ready(function () { // Map categories in filter to their corresponding summary-item URLs const categoryMap = { '#Relationships': [‘?category=Relationships’] }; // Handle click events on links in .blog-custom-filter $('.blog-custom-filter a').on('click', function (e) { e.preventDefault(); // Prevent default behavior of the link // Remove the 'active' class from all links and add it to the clicked link $('.blog-custom-filter a').removeClass('active'); $(this).addClass('active'); // Get the category from the href of the clicked link let category = $(this).attr('href'); if (category === '#all') { // Show all summary-item elements if 'ALL' is clicked $('.summary-item').show(); } else if (categoryMap[category]) { // Hide all summary-item elements $('.summary-item').hide(); // Show only summary-item elements containing the matching category link $('.summary-item').filter(function () { // Check for both URL formats return categoryMap[category].some(cat => { return $(this).find(`a[href="/blog?category=${cat}"], a[href="/blog/?category=${cat}"]`).length > 0; }); }).show(); } }); }); </script> You can share link to page where you want to run the code, I can check easier note 1. Keep # format so your Code Block should be <h5 class="blog-custom-filter"> <span style="line-height:2em;"> <a href="#All" class="active">ALL</a> <br> <a href="#Relationships" target="_self">Relationships</a> </span> </h5> 2. top arrow is invalid, your apostrophe is slanted, you can see bottom arrow, the apostrophe is vertical and it is correct Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
RichardR Posted Wednesday at 09:51 AM Author Posted Wednesday at 09:51 AM Thank you. https://www.probation-institute.org/the-griffins-society-research-listings
RichardR Posted Wednesday at 09:58 AM Author Posted Wednesday at 09:58 AM Hey @tuanphan I've made those changes, but still not quite there yet.
RichardR Posted Wednesday at 08:57 PM Author Posted Wednesday at 08:57 PM (edited) So, you can see on the first screenshot when you select either 'all' or 'relationship' as a filter, it removes everything. On the second screenshot, be good if I can have the categories not showing. Many thanks. Edited Wednesday at 08:58 PM by RichardR
RichardR Posted 11 hours ago Author Posted 11 hours ago Hi @tuanphan just wondered if you’ve had chance to take a look yet? Appreciate you’ll be busy, I am grateful for your help.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment