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
Ouput all category names | Event Espresso - Staging Server

Support

Home Forums Event Espresso Premium Ouput all category names

Ouput all category names

Posted: October 22, 2013 at 5:32 am

Viewing 3 reply threads


Geoff Lewin

October 22, 2013 at 5:32 am

How would I output all my category names as a list in a php template?

Also can I output all ‘Unique Category Identifiers’ in PHP?

Thanks
Geoff


Dean

  • Support Staff

October 23, 2013 at 12:44 am

Hi Geoff,

I don’t believe we have any shortcodes to do this, but if you are doing it via PHP, then a short SQL query might work for you:

	$sql = "SELECT * FROM " . EVENTS_CATEGORY_TABLE;
	$categoryarray = $wpdb->get_results($sql);

That will give you an array of the category table, then just use a foreach loop to go through it and out put what you need.


Geoff Lewin

October 24, 2013 at 4:44 am

Hi Dean
Thank you for that.
I would now like to use the ‘Unique Category Identifiers’ as class names in my espresso_table so that I can filter the list by using checkboxes instead of the category name. This is what I have at the moment in espresso_table.php
<tr class="espresso-table-row <?php echo do_shortcode('[CATEGORY_NAME event_id="'.$event->id.'"]');?>">

How do I query the table and return the correct categories for each event in-place of the shortcode?

This is what I have so far.

<code>$sql = &quot;SELECT category_identifier FROM &quot; . EVENTS_CATEGORY_TABLE;
$categoryarray = $wpdb-&gt;get_results($sql);

foreach ($categoryarray as $option) {
echo $option-&gt;category_identifier;
}</code>

Thanks Geoff


Dean

  • Support Staff

October 24, 2013 at 5:59 am

Hi Geoff,

If you are looking for a table with a category filter, you may want to hang fire, as we are going to release (hopefully very soon) an add on that has a table that the the user can filter by categories. (This may be a separate purchase or part of a licence nothing has been decided on that so please be aware it may cost). sneak peak – http://d.pr/i/Uatn

However if you are just wanting to manually filter the list, you could query the $event array. Each $event array contains the category ID’s associated with that event. Then you would need to either query the database to pull the category name via the ID or just continue using the shortcode as that works well and is simple enough.

Viewing 3 reply threads

The support post ‘Ouput all category names’ 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