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
Show categories | Event Espresso - Staging Server

Support

Home Forums Custom Files Show categories

Show categories

Posted: July 26, 2012 at 1:40 am

Viewing 5 reply threads


Roddy Boyd

July 26, 2012 at 1:40 am

Hello Everyone,

Spent ages looking for a solution to this, which i couldn’t find so i wrote my own short code to accomplish this add the below code to the shortcode.php file located in – /wp-content/plugins/event-espresso/includes
needs a little work to display the categories properly but this will give you a good start

this is the code

/*
 
  Event Categories
  Displays a list of events by category
  [EVENT_ESPRESSO_CATEGORIES cats="1,2,3,4" links="76,79,86,88"]>
 cats = the categorie id you want to show       links = the page that is category is shown on
 */
if (!function_exists('show_categories')) {
    function show_categories($args) {
        global $wpdb;
    
        define("EVENTS_CATEGORY_TABLE", $wpdb->prefix . "events_category_detail");       
        $catsToShow = explode(",", $args['cats']);
        $pageLinks = explode(",", $args['links']);
        $whereCondition = '';
        if($catsToShow){
            foreach($catsToShow as $catKey => $cat){
                if($catKey == 0)
                    $whereCondition .= "WHERE id='".$cat."'";
                else
                    $whereCondition .= "OR id='".$cat."'";
            }
        }
        
        //$html = print_r($catsToShow);
        //Category sql
        $sql .= 'SELECT * FROM `'.$wpdb->prefix . 'events_category_detail` '.$whereCondition;
        
        $categories = $wpdb->get_results($sql);
        if($categories){        
        //$html = print_r($categories); 
            foreach($categories as $fullKey => $category){
                $html  .= ' ';
                $html .= $category->category_name;
                $html .= 'category_name.'" >View Information';
                $html .= '';
            }
            return $html;
        }else{
            return 'Something Went wrong, please make sure the shortcode is entered correctly'; 
        }
        
    }
}
add_shortcode('EVENT_ESPRESSO_CATEGORIES', 'show_categories');

  • This topic was modified 12 years, 5 months ago by Roddy Boyd.


Roddy Boyd

July 26, 2012 at 2:01 am

Looks like alot of my divs have been stripped out.

  • This reply was modified 12 years, 5 months ago by Roddy Boyd.


Seth Shoultes

  • Support Staff

July 26, 2012 at 2:22 am

I created a Piratepad for you if you want to post the code there:
http://piratepad.net/ep/pad/view/ro.$JzC26tEzBe/latest

  • This reply was modified 12 years, 5 months ago by Seth Shoultes. Reason: Changing piratepad URL so no one can edit it


Roddy Boyd

July 26, 2012 at 2:29 am

Ok thanks my latest code is in there. Who ever wants to user it please feel free


Josh

July 26, 2012 at 9:53 am

Thanks for sharing. If you add the function in the custom_functions.php file of the custom files add-on, you won’t lose your changes on a software update. See this section in the documentation for more info:
http://staging.eventespresso.com/wiki/custom-files-addon/


Josh

August 10, 2012 at 7:31 am

Update: This has been added to Event Espresso 3.1.26.P. Thanks Roddy!

Viewing 5 reply threads

The support post ‘Show categories’ 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