kirschdaniel
Forum Replies Created
-
Cool. A good reason to upgrade. Thanks for your answer.
@angelo_nwl
Thanks for your support.
After following your advice, I found out that my theme used the following script in the functions.php:wp_deregister_script(“jquery-migrate”);
*OUTCH*
Removing this line solved the problem!Sorry for the false alert.
DanielForum: Plugins
In reply to: [VS Event List] Using a custom snippet for widget and event listGuido,
I like your straight point of view and am totally fine with your answer.Finally your plugin and this discussion helped me a lot to understand the practical nature of WP plugins.
Have a good day
DanielForum: Plugins
In reply to: [VS Event List] Using a custom snippet for widget and event listGood morning Guido,
I’m very happy to see you interested in your users suggestions and I have a huge respect for your effort. If the implementation is far more work than expected, it would probably be much easier to maybe add some additional HTML and classes and just style the thing using CSS. So in other words: Keep it simple.I’m totally new to WP-Plugin programming so my ideas might be harder to implement than I think.
After taking a deeper look at the widget and your code, here is how I would try to implement it:
– A snippet consists of two parts. The html code and a name. It can be defined on the plugins setting page.
– It can be included using a shortcode. Additional attributes might be given in the shortcode – comparable to your current implementation.[vsel-snippet name="mysnippet" posts_per_page="5"]
Some Pseudocode to illustrate the idea:
snippet = getSnippet($snippet['name']); if (snippet) loop properties = getSingleEventProperties() // include 'vsel-meta.php'; output = replaceSnippetVariablesWithEventProperties(properties ) // include 'vsel-snippet.php'; endloop endif
Some suggestions
In vsel-widget-meta.php instead of using an individual variable for each data, I would use a hash. This would make it much easier to simply replace strings from the snippet.So instead of
$widget_start_date = get_post_meta( get_the_ID(), 'event-start-date', true ); $widget_end_date = get_post_meta( get_the_ID(), 'event-date', true ); $widget_time = get_post_meta( get_the_ID(), 'event-time', true );
You might use this:
$props = ['event-start-date', 'event-date', 'event-time']; $id = get_the_ID(); $vselProps = []; foreach ($props as $prop => $val) { $vselProps[] = get_post_meta( $id, $val, true ); }
Add additional properties
$vselProps['event-title-with-link'] = '<a href="'. get_permalink() .'" rel="bookmark" title="'. get_the_title() .'">'. get_the_title() .'</a>';
And in your snippet script you might then search for the {…} patterns and replace them.
Here is a small proof of concept I just wrote:
<?php $snippet = '<div class="event"> <h4 class="event-title">Start: {start-date}</h4> <div class="event-content"> <p class="event-date">End: {end-date}</p> <p class="event-time">Time: {time}</p> <p class="event-location">At: {location}</p> </div> </div>'; $props = ['event-start-date' => 'Today', 'event-end-date' => 'Tomorrow', 'event-time' => '12:00-14:00', 'event-location' => "home"]; $vselProps = []; foreach ($props as $prop => $val) { // remove the "event-" part just to keep it simple in the snippet $propWithoutEventPrefix = preg_replace("/^event-/", "", $prop); $vselProps[$propWithoutEventPrefix] = $val; } // replace all occurences in the snippet echo preg_replace_callback( "/{(.+)?}/", function ($foundPattern) { global $vselProps; return $vselProps[$foundPattern[1]]; }, $snippet ); ?>
Cheers
DanielForum: Plugins
In reply to: [VS Event List] Using a custom snippet for widget and event listMe again,
would be cool to be able to provide at least two snippets. One to be used for the widget in a sidebar and one on the list of events. And to make it complete, the third snippet could be the single event page.Forum: Plugins
In reply to: [VS Event List] Using a custom snippet for widget and event listGuido,
I’m happy to read that you like the idea.I would define the snippet directly on the VSEL settings page. (Or an additional vessel snippet page.) IMHO this would make it easier for you to deal with it and I only have a little shortcode in my text.
In the first step, one single snippet is enough, but being able to add more snippets might be a cool feature. Each snippet might then be used using a shortcode and an id.
[vsel id="23"]
The shortcode might be displayed directly beside the snippet. Or – more readable – I can give my snippet a name and use this instead:
[vsel snippet="myevents"]
or[vsel name="myevents"]
Good luck with your other plugin. What is it about?
Cheers
DanielForum: Plugins
In reply to: [VS Event List] Using a custom snippet for widget and event listHi Guido,
thanks for your answer and interest! Yes, exactly. I (plugin user) write the snippet. Your plugin parses it and replaces every occurence of {VARIABLE_NAME} with the defined variable value. At least, that’s one typicall approach used by other WP plugins.
VSEL offers the list of variables that can be used in the snippet. They might or might not start with “vsel”.The variables could be:
startDate endDate startAndEndDate time location link image imageWithLink title titleWithLink categories categoriesWithLink description summary moreInfoText linkMoreInfo moreInfoTextWithLink openMoreInfoInNewWindow
To be able to control the displayed events, the allready implemented attributes might be to use as a HTML data attribute. eg:
<div data-vsel="posts_per_page:5;event_cat:'first-category, second-category'"> <div class="event"> ... </div> </div>
Or using single attributes:
<div data-vsel-posts_per_page="5" data-vsel-event_cat="first-category, second-category"> <div class="event"> ... </div> </div>
You may even add some logic like:
<p data-vsel-if="no_events==true">Sorry, no events this time</p> <div data-vsel-if="no_events==false"> Here are the upcomming events </div>
Or maybe easier: provide it as a variable I may then controll via CSS
<div class="{vselEventsClass}"> <p class="no">Sorry, no events this time</p> <p class="yes">Here are the upcomming events...</p> </div>
Where
vselEventsClass
is either “events”, when at least one event is given or “no-events” when no event is available.In my CSS I could then use selectors like this:
.no-events > .yes, .events > .no { display: none; }
Of course, the vsel settings like “don’t show the date” are not relevant when using a HTML snippet as this is then responsible for the informationen it wants to provide.
Cheers
DanielI havn’t tried adding a second person to check your suggestion.
So far I’ve used the following in my functions.php
// Send mails when a booking happened add_action('em_booking_add', function($EM_Event) { global $EM_Booking; $msg = "New booking\n" . "'" . $EM_Event->event_name . "' at " . $EM_Event->event_start_date . "\n\nDETAILS:\n" . $_REQUEST['user_name'] . "\n". $_REQUEST['user_email'] . "\n". $_REQUEST['dbem_phone'] . "\n\n". "User comment:\n'" . $EM_Booking->booking_comment . "'\n"; $msg = wordwrap($msg, 70); // Send mail mail('[email protected]', 'New booking', $msg); });
Not elegant but working. Instead of using the $_REQUEST object to retrieve the information, I’ve also tried to use the $EM_BOOKING object, but at the time the “em_booking_add” action gets fired, the $EM_BOOKING object doesn’t contain all data.
Cheers and thanks for the support
Daniel- This reply was modified 7 years, 7 months ago by kirschdaniel. Reason: Format the code
Thanks for the request. Because I had to many issues, I switched to another plugin. So I currently don’t need any help.
Finally I’m both the admin and the author and responsible person for the event.
Forum: Plugins
In reply to: [Events Manager - Calendar, Bookings, Tickets, and more!] Change ticket orderThat’s a good hint. Now I can at least define an ordner using numbers in front of the ticket name.
Would be cool to be able to define my own order in a next version or to be able to select “Order by Ticket-ID” which should result in the order they are defined.Thanks!
DanielJust for the records, this is what I’ve done now:
1. I’ve added a custom attribute #_ATT{multipleTimes}{YES|NO}
This gives me a select box with YES and NO options on the event page.2. I’ve changed my template for the “single event format” to contain the new attribute as a class:
<div class="event multiple-times-#_ATT{multipleTimes}"> #_EVENTNOTES ... other stuff ... {has_bookings} #_BOOKINGFORM {/has_bookings} </div>
So when I select YES for the multipleTimes attribute, I get a class multiple-times-YES for my event container.
3. I added the CSS definition:
.multiple-times-YES .event-row-date { display: none; }
to simply hide the row with the fixed date.
4. I added the individual times for each day at the end of the event’s description.
- This reply was modified 7 years, 9 months ago by kirschdaniel. Reason: Fixed css typo
This sounds good. And show it only when available using the technique described in the tutorial:
https://wp-events-plugin.com/tutorials/creating-conditional-placeholders-for-events/Would that do the job or am I on the wrong track?
Thanks
DanielTried PHP Mail now which seems to work fine. Thanks for your help!