Posted: 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 | |
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. | |
Hi Dean 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 = "SELECT category_identifier FROM " . EVENTS_CATEGORY_TABLE; $categoryarray = $wpdb->get_results($sql); foreach ($categoryarray as $option) { echo $option->category_identifier; }</code> Thanks Geoff | |
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. | |
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.