Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-sales domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the better-click-to-tweet domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-amazon domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-stats domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Alternative Function to [CATEGORY_NAME] Shortcode | Event Espresso - Staging Server

Support

Home Forums Event Espresso Premium Alternative Function to [CATEGORY_NAME] Shortcode

Alternative Function to [CATEGORY_NAME] Shortcode

Posted: August 30, 2013 at 3:38 pm

Viewing 2 reply threads


Deborah Walden

August 30, 2013 at 3:38 pm

I’m currently using this to get a list of associated categories for my event listings:
[code language=”php”] $programs_string = do_shortcode(‘[CATEGORY_NAME event_id=”‘.$event_id.'”]’);
$programs_array = explode(‘,’, $programs_string );[/code]

This would usually work great, except that some of my categories have commas in them, so using a comma delimiter is not going to work in this case. Is there a more direct public function that I can use to get an array of categories, not a string?


Josh

August 30, 2013 at 5:30 pm

Hi Deborah,

I checked and couldn’t find a more direct public function that outputs an array of categories.

I may not be understanding the issue completely, but will it work to use a pipe ( | ) as the delimiter?


Deborah Walden

September 3, 2013 at 11:49 am

Hi Josh, actually that is what I ended up doing. I had to modify a core function though :(. Here is what I did:

On line 850 of the event-espresso/includes/functions/main.php

[code language=”php”]$category_data[‘category_name’] .= $result->category_name . ‘|’;[/code]

In replacing the comma with a pipe, I was able to successfully use the php explode() function to get a true array of categories, including those with commas in them.

Viewing 2 reply threads

The support post ‘Alternative Function to [CATEGORY_NAME] Shortcode’ 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.

Event Espresso - Staging Server