Posted: August 9, 2012 at 7:32 am
|
I realize this may go beyond a \’regular\’ support question but I\’m no php-wiz and I hope someone might have an idea that can help me along. I would however like to be able to customize the output somewhat more. First of all I’d like to be able to style the categories\’ labels seperately eg. in a unordered list. The reason for this being that I\’d like to assign different colors to different categories and link each category lable to a category page displaying a list of events belonging to the category label clicked. But no luck here. And this connected to another issue… So far I’ve gone about this by setting up a page for each category displaying the list of events belonging to that particular category. Every category page is a child page of the page containing the entire event list. I’ve given every page the exact same name as the category_identifier. The idea being that I could solve my problem by dynamically outputting the category_identifier and append it to the base url of the parent page and output the link on the top-level event-list page. So far far I’ve managed by using the above mentioned shortcode and wrapped the output in a link (as above – with the exception that the shortcode outputs the category_name – not the identifier). This works as long as only one category is assigned to the event. And its not exactly pretty. This is about as far as I’ve come… I been over the documentation but so far I’ve hit a wall. Any ideas will be greatly appreciated! Thanks |
Hey Runemaster, There was a new shortcode added to 3.1.26.P that might be just what you’re looking for. It was actually something that another user of Event Espresso contributed in the forums. The syntax goes something like this: |
|
|
Hi Josh, Great news! I’ll keep a look out for the shortcode in the upcoming release. Thanks! |
Event Espresso 3.1.26 has been released, and the above shortcode is included. |
|
|
Thanks! Still having problems though… |
It looks like you’ve got the special characters part worked out, as ‘Særrangementer’ looks correct to me. I could be wrong about that though. So if you want to add markup so that the each of the category names will be within a list item, you’ll need to modify the espresso_event_category_data function in /includes/functions/main.php which starts around line 736. If you look at that function, the line where you’ll want to add the markup is the one that has the category name. Something like this will wrap it in an list item and add a class name based on the unique category ID for styling:
Note that this is a pluggable function, so the entire function can be copied over to the custom_functions.php file that is included with the custom files add-on. If you copy this function over, your changes will not get overwritten when Event Espresso gets updated. By the way, this site looks awesome, please consider submitting this site for inclusion to our showcase. |
|
|
Hi Josh, Thanks a lot for your helpful suggestions. I finally nailed it by modifying the file you suggested (line 755) to this:
as you can see I modified it quite a bit – to make it behave as I intended. Linking category names by way of the category identifier to category pages (all are subpages of the page containing the event list). I’ll be sure to upgrade my license to be able to add the custom files add-on. By the way: A small localisation issue on line 536 – the ‘Unlimited’ text should probably be added to the textdomain. And thanks for complimenting the site. I’ll submit my site to the showcase once it’s ready to go live 😉 Cheers Rune note: it seems the code is being stripped of some of the tags – sorry…
|
Glad you’ve found a solution that works. We have an open ticket to go through and address the non-localized text strings, and ‘Unlimited’ is on that to-do list. |
|
The support post ‘Dynamically linking category labels to category pages’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.