Jump to content
Sign in to follow this  
aequator

Carousel using current categories

Recommended Posts

aequator

I'm setting up a website (aequator.goedgehost.nl) that uses four major "themes" (nature, water, soil, and spatial development) as a way of organising the information. On the homepage I now have four boxes that link to the corresponding categories. What I want to do next is show a carousel (below the navigation) of the latest posts of the current category. So when I go to a different theme (e.g. "nature"), I see the category view, with a carousel with the latest posts of the category "nature". Of course, in category "water" you'll only see the latest posts of the category "water" in the carousel. And then I want to add something else: I have more than only these four categories. Can I code it so that the carousel only shows up in these four categories? In the mean time I will look into the file. I'm presuming that the file will be in platformprosectionscarouselsection.carousel.php or something like that. greetings, Lars

Share this post


Link to post
Share on other sites
bryan-hadaway

Hmm, this is going to be PHP customization. Let see if I can get some insight, forwarding to developers. Thanks, Bryan

Share this post


Link to post
Share on other sites
cmunns

The correct file to look at would be section.carousel.php Look for this line `if($carousel_post_id) $carousel_post_query .= '&category_name='.$carousel_post_id;` and modify it to do some other actions that override the carousel_post_id option in the theme such as `if(is_category(21)) $carousel_post_query .= '&category_name='.21;` In this case it's just checking to see if the category id is 21 and if it is the carousel will pull from that category. Do you know how to find category IDs?

Share this post


Link to post
Share on other sites
aequator

Hi there Cmunns, I've been swimming through the code until finally it seemed to work (with an adaptation from your code):

if(is_category('9')) $carousel_post_query .= '&cat=9';
	if(is_category('15')) $carousel_post_query .= '&cat=15';
	if(is_category('16')) $carousel_post_query .= '&cat=16';
	if(is_category('18')) $carousel_post_query .= '&cat=18';

It might not be the neatest code but hey, it works :) 1) I've put the category ID in '', which seemed to be necessary. 2) &category_name only works with name, I've used &cat which works with ID 3) when in a different category, it seems to display all posts it can find, which actually is fine by me 4) again (as noted in another post), the base section.carousel.php doesn't seem to override the platform pro theme file (have you checked with Andrew yet?) When I come across any additional problems, I'll contact you. Thanks again!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×