Extend Plugin/shortcode functionality

I am using the Events+ plugin. I’m using the ‘next event countdown’ sub-plugin (i.e. a plugin for the events plus plugin). I want to be able to add the event’s name as part of what the shortcode displays.

I’m not a PHP developer by trade, I’m certainly capable of doing the work but it’s not in my day to day wheelhouse. I could use some help with what to do here…I know the file is ‘eab-events-countdown-for-next-event.php’ but I don’t know what to add to it for it to display the event name. I’m guessing it’s a combination of modifying the SQL query to pull back the event name plus adding in a new name/value pair in the array to optionally display it. Any help is appreciated!

  • PC
    • WPMU DEV Initiate

    Hello again Mike,

    Thanks for the wait.

    I pinged our lead developer for this as I knew he would have this handy.

    In file : lib/plugins/eab-events-countdown-for-next-event.php, line 236

    Replace :

    return "<div id='eab_next_event_countdown".$id."'" . $class ."></div>". $script;

    With

    return “<h4>post_id) . “‘>” . get_the_title($result->post_id) . “</h4><div id=’eab_next_event_countdown”.$id.”‘” . $class .”></div>”. $script;

    And you will get the Event name as a H4 link.

    I have also moved this to the feature request forum and tagged Vlad so that we can include this as a shortcode attribute in the next version :slight_smile:

    Thanks for being a great member of the community and have a nice day.

    Cheers, PC

  • mike_earley
    • Flash Drive

    Here is what I’m trying right now that isn’t working…(note, replaced h4 with div intentionally)…

    return "<div" . $post_id . ">" . get_the_title($result->post_id) . "</div><div id='eab_next_event_countdown".$id."'" . $class ."></div>". $script;

    It returns the event name correctly but isn’t posting in the countdown anymore.

  • Vladislav
    • Dead Eye Dev

    Hello,

    The markup/code got garbled in the quote somewhat, but I’m glad you managed to figure out the base idea (using the post_id property of the $result object). Perhaps you’d like to try the attached Beta version, which supports a new title=”yes” attribute for the next event countdown shortcode. If set to “yes”, the shortcode will output the event title too before the counter. Can you please have a look and see if it helps?

  • mike_earley
    • Flash Drive

    Plugin in action

    OK–we’re getting close here, the countdown still isn’t appearing? Here is what I did:

    (1) de-activate events+

    (2) rename ‘events_and_bookings’ folder to ‘_old_events_and_bookings’

    (3) install new version of plugin

    (4) validate all settings

    (5) change shortcode to [next_event_countdown title=”yes”]

    The title is working, the countdown is not appearing. I had, per previous instructions, modified the ‘eab-events-countdown-for-next-event.php’ file (partially) into the same state, but now that file has been moved out to the side obviously, in the ‘_old_’ version of the plugin, and that shouldn’t be an issue. So why isn’t the countdown appearing?

  • mike_earley
    • Flash Drive

    Interestingly, the countdown actually works on certain pages. For example, if you get a 404 page or go to the facebook registration page, it’s working as expected. To get to the facebook registration page, go to The Website and click ‘Sign Up’, then ‘register with facebook’, and you’ll see the widget, working as expected.

  • Vladislav
    • Dead Eye Dev

    Hello,

    Thank you for sharing the link to the website. If the widget with the shortcode is the one on the top left (titled “Countdown To:”:wink:, then I’m able to see it just fine on the registration page (as you said), as well as on the home page and on couple of other pages I tried – it seems to be working for me. Could this perhaps be a cache issue? If you’re running some sort of caching plugin, can you please purge your cache and try again? Also, can you please try clearing your browser cache or force-reloading the page (Ctrl+F5 on Windows, Shift+Refresh on Mac)? Please note, if you’re using Chrome, your best bet would be to actually clear your browser cache, or visit the page in incognito mode.

  • mike_earley
    • Flash Drive

    Yep. I keep ‘disable cache’ on by default, being a front-end developer by trade, and am familiar with the cmd-shift-R also, which i did many times. At some point it just started working. I’m in chrome. I didn’t purge, I probably should have done that. Regardless, thanks for all of the help.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.