• Resolved TreeTrail

    (@aprilschmitt27)


    I’ve been trying unsuccessfully to make this work for many days! Two best attempts are below. I need to create a report that:

    *groups Events Manager events under their categories
    *sorts by wp_terms.term_group, wp_terms.term_order, #_EVENTDATES, #_EVENTTIMES
    *limits each section to a different parent category (or term_id numbers)
    *doesn’t have info displaying in strange places

    Item 1: used Events Manager [events_list] and shortcodes, result: data accurate but no grouping or sorting

    Item 2: copied from Pastebin [category_events_list_group] php into mu_plugin (text below), result: grouping I think but no event data & faulty sorting

    /*********************

    <?php
    /*
    Shortcode Name:category_events_list_group
    Plugin URI: https://www.
    Description: Group Events List By Category
    Version: .1
    Author: Events Manager
    Author URI: https://wp-events-plugin.com/
    */

    /*
    Added this code to create a new shortcode
    [category_events_list_group]
    That can group events by category type.
    */

    function em_events_list_by_category(){

    $EM_Categories = EM_Categories::get($args);

    foreach( $EM_Categories as $EM_Category ){

    echo “<h2>”.$EM_Category->name.”</h2>”;
    echo do_shortcode(‘[events_list category=”‘.$EM_Category->term_id.'”]’);

    }

    }

    add_shortcode(‘category_events_list_group’, ’em_events_list_by_category’);

    **************/

    …Any help would be very greatly appreciated!!!

    ~April

    [email protected]

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    here’s another snippet which may help you with this – https://pastebin.com/f6DVrzZS

    As for where to paste custom snippet – https://wp-events-plugin.com/tutorials/how-to-safely-add-php-code-to-wordpress/

    I am not part of support just some dude…
    maybe I am missing something here…

    Are you trying… with the Pastebin code for a new shortcode…
    to automatically have the events, grouped by category.. ?
    That is, when you add a new category it automatically appears on that page.

    If you were to manually put each category on that page…
    does something like this not work ?
    WTC Club Meetings
    [events_list category="107]

    https://wp-events-plugin.com/documentation/event-search-attributes/
    category
    Supply a single id, slug or comma-separated ids or slugs (e.g. "1,categories-slug,3") to limit the search to events in any of these categories.

    • This reply was modified 7 years, 4 months ago by Robswaimea.

    Thanks Angelo.. always learning new things.

    I just popped in Angelo’s suggestion in my theme’s function.php file and it works.

    The list will populate what you have set up in your settings for a an events list.

    Thread Starter TreeTrail

    (@aprilschmitt27)

    angelo_nwl & Robswaimea,

    Thank you so much for your prompt replies. Please allow me to try to better explain with 2 examples (with line spaces condensed):

    1.
    METHOD: EM Shortcodes

    PROBLEM: Data & criteria are correct, but must group & order by EM Categories (preferably by term_group,term_order, but alpha category name would work too)
    (great also would be child under parent categories, but if I can limit the category id’s, I can keep all “Hiking” in one page section & all “Cycling” in another, etc)

    PAGE:
    [events_list category=”43,44,45,46,48,49,50″ scope=future orderby=”event_start_date” order=”ASC”]
    <p>
    #_CATEGORYNAME
    #_EVENTDATES at #_EVENTTIMES: “#_EVENTNAME”
    </p>
    [/events_list]

    RESULTS:
    Saturday Short Hikes
    10/21/2017 at 10:00 am – 12:30 pm: “Middle Run Valley Natural Area”

    Saturday Medium Hikes
    10/21/2017 at 9:00 am – 1:00 pm: “White Clay Creek State Park”

    Sunday Hikes
    10/22/2017 at 1:00 pm – 4:00 pm: “New Castle, DE”

    Wednesday Evening Hikes
    10/25/2017 at 6:30 pm: “Chesapeake City, MD”

    Wednesday Midweek Hikes
    10/25/2017 at 9:00 am – 1:30 pm: “Cheslen Preserve, Chester County, PA”

    Wednesday Miler Hikes
    10/25/2017 at 9:00 am: “WCCSP, Nine Foot Road parking area”

    Saturday Medium Hikes
    10/28/2017 at 9:00 am – 1:00 pm: “Elk Neck State Park”

    Saturday Medium Hikes
    11/11/2017 at 9:00 am – 1:00 pm: “First State National Historical Park”

    Saturday Medium Hikes
    11/18/2017 at 9:00 am – 1:00 pm: “White Clay Creek State Park”

    …like all “Saturday Medium Hikes” need to group together, with dates & event details under
    ———————————————————————————
    2.
    METHOD: Angelo’s 2013 Create Shortcode & EM Shortcodes

    PROBLEM: It’s trying to group, but no events, & not solving above problems either

    PHP:
    <?php
    function em_events_list_by_category(){
    $EM_Categories = EM_Categories::get($args);
    foreach( $EM_Categories as $EM_Category ){
    echo “<h5>”.$EM_Category->name.”</h5>”;
    echo do_shortcode(‘[events_list category=”‘.$EM_Category->term_id.'”]’);
    }
    }
    add_shortcode(‘category_events_list_group’, ’em_events_list_by_category’);

    PAGE:
    [category_events_list_group=”43,44,45,46,48,49,50″ scope=future orderby=”event_start_date” order=”ASC”]
    <p>
    #_CATEGORYNAME
    #_EVENTDATES at #_EVENTTIMES: “#_EVENTNAME”
    </p>
    [/category_events_list_group]

    RESULTS:
    WTC Calendar Notices
    No Events
    WTC Volunteer Efforts
    Event Event Details
    [location_search_form ajax=1]
    WTC
    No Events
    WTC Club Meetings
    No Events
    WTC Social Gatherings
    No Events
    HIKING
    No Events
    Multiple Day Backpacking
    No Events
    New Member Hikes
    No Events
    Saturday Long Hikes
    No Events
    Saturday Medium Hikes
    Event Event Details
    [location_search_form ajax=1]
    Saturday Short Hikes
    Event Event Details
    [location_search_form ajax=1]
    Sunday Hikes
    Event Event Details
    [location_search_form ajax=1]
    Impromptu Hikes
    No Events
    Wednesday Midweek Hikes
    Event Event Details
    [location_search_form ajax=1]
    Wednesday Miler Hikes
    Event Event Details
    [location_search_form ajax=1]
    Wednesday Evening Hikes
    Event Event Details
    [location_search_form ajax=1]
    Thursday Hikes
    No Events
    Multiple Day Hiking
    No Events
    Holiday Hikes
    No Events
    Annual Brandywine End To End Hike (E2E)
    No Events
    Annual Hike Across Delaware (HAD)
    Event Event Details
    [location_search_form ajax=1]
    Work Hikes
    Event Event Details
    [location_search_form ajax=1]
    PADDLING
    No Events
    Whitewater Paddling
    No Events
    Recreational Paddling
    No Events
    Pool Session Paddling
    No Events
    Training Paddling
    No Events
    Open House Paddling
    No Events
    Safety Session Paddling
    No Events
    CYCLING
    No Events
    Tuesday Cycling
    Event Event Details
    [location_search_form ajax=1]
    Friday Cycling
    No Events
    Other Cycling
    No Events
    SKIING
    Event Event Details
    [location_search_form ajax=1]
    Cross-Country Skiing
    Event Event Details
    [location_search_form ajax=1]
    ———————————————————————————

    Any suggestions would be greatly appreciated.

    ~April

    The [category_events_list_group] shortcode doesn’t accept any attributes or parameters. If you want to be able to specify which categories are used you’d need to customize the code.

    Thread Starter TreeTrail

    (@aprilschmitt27)

    caimin_nwl, thank you very much for responding promptly. So if at minimum, I use only this:

    PAGE:
    [category_events_list_group]
    #_CATEGORYNAME
    #_EVENTDATES at #_EVENTTIMES: “#_EVENTNAME”
    [/category_events_list_group]

    ONE RESULT EXAMPLE:
    WTC Volunteer Efforts
    Event Event Details
    [location_search_form ajax=1]

    PROBLEM:
    What do I need to do display the events, rather than: “[location_search_form ajax=1]”?

    Regarding custom code to include other attributes or parameters, would an EMPro account include this type of more time intensive support?

    Any suggestions would be greatly appreciated.

    ~April

    Unfortunately, we’re not able to offer in-depth support for custom coding issues, even for Pro customers.

    Are you saying that the output of [category_events_list_group] is including
    “[location_search_form ajax=1]” ?

    Thread Starter TreeTrail

    (@aprilschmitt27)

    caimin_nwl,

    Thank you for clarifying about level of support. We are willing to pay for this type of support. Does any of the staff do this type of work outside of their main job? If you can point me in the some good direction, I’d really appreciate it.

    Most urgently, yes the output of [category_events_list_group] is including “[location_search_form ajax=1]”, instead of the actual event details.

    LITERALLY THIS:
    WTC Volunteer Efforts
    Event Event Details
    [location_search_form ajax=1]

    Thank you very much.

    Do you have [location_search_form ajax=1] under “Default event list format” under Events > Settings > Formatting > Events?

    My apologies for stepping in here…
    I see on your website that you are producing event lists in a couple of different ways.

    With the shortcode we have been discussing… I am producing a list.. yet
    on your “print” page nothing is producing, with the shortcode
    [category_events_list_group]
    Obviously you know this…

    On my site… the shortcode [location_search_form ajax=1]
    does work.

    So with no events showing.. and the above shortcode.. just showing as a “text” or ie: not a valid shortcode… yet it is..

    Something is a bit wrong… looking at your “print” page.. and Firefox inspector.. I don’t see any major errors.

    Is the page at https://dev.wilmingtontrailclub.org/wtc-event-print/ an actual “Live” use of the shortcodes… or just a reproduction of your problem ?

    Well… hopefully you’ll get some of this working.
    thank you in advance for clarifying.

    • This reply was modified 7 years, 4 months ago by Robswaimea.
    • This reply was modified 7 years, 4 months ago by Robswaimea.
    Thread Starter TreeTrail

    (@aprilschmitt27)

    caimin_nwl,

    You have identified my mistake …thank you for helping me. Somehow I must have entered [location_search_form ajax=1] under Events > Settings > Formatting > Events > Default event list format. I have now successfully replaced it with the desired placeholders, resulting in the actual event details!

    Is it possible to make EM’s [category_events_list_group] (below) sort the categories by basic alpha? :
    ——–
    function em_events_list_by_category(){
    $EM_Categories = EM_Categories::get($args);
    foreach( $EM_Categories as $EM_Category ){
    echo “<h5>“.$EM_Category->name.”</h5>”;
    echo do_shortcode(‘[events_list category=”‘.$EM_Category->term_id.'”]’);
    }
    }
    add_shortcode(‘category_events_list_group’, ’em_events_list_by_category’);
    ——–

    …if not, could you please suggest a PHP sorting example or online training?

    Thank you so very much! ~April

    Thread Starter TreeTrail

    (@aprilschmitt27)

    Robswaimea,

    Thank you for trying to help and for taking a look at my site. How were you able to see: https://dev.wilmingtontrailclub.org/wtc-event-print/ …if there’s no menu access to it? Do I have a security hole, that allowed you to the dashboard?

    ~April

    The link is in your first post. ??
    and it looks like you have the shortcode working !! ?? ??

    Thread Starter TreeTrail

    (@aprilschmitt27)

    Robswaimea,

    :)) and yes, the grouping shortcode is working …but unless I can sort the categories, it won’t be of use. Are you aware of any example solutions that are similar?

    Thank You,
    April

    Is this what you’re looking for?

    https://pastebin.com/f6DVrzZS

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Grouping & Sorting Events Manager Events by Category’ is closed to new replies.