display eventlist in Mailpoet Newsletters
-
Hi Franky and fellow Evneters,
Sorry if this is a bit off topic, but I am trying to display an eventlist in a Mailpoet Newsletterfollowing https://support.mailpoet.com/knowledgebase/hook-to-add-your-own-shortcode/.
The examples (my_name and blog_name) display fine, but the Events Made Easy event list displays to the upperleft corner of my browser window in a preview of the newsletter, instead of to the content of the newsletter.
Also if I send an example of the newsletter it pops up a message like “Request error Not JSON ….”.Here’s the modified example code I put in function.php:
/** * This is an example of a custom shortcode parser for MailPoet newsletters. * It's really easy to implement. * We already automatically parse all shortcodes with this notation for you: [custom:my_value] * You just have to add a filter and return the value you prefer. * In the following example we added [custom:my_name] and [custom:blog_name] to our newsletter. * We have now to return the preferred values, as string. */ // [custom:my_name] // [custom:blog_name] function mailpoet_shortcodes_custom_filter( $tag_value , $user_id) { // $tag_value contains the string after custom: // This function will be called the first time with $tag_value = my_name // The second time with $tag_value = blog_name // $user_id contains the corresponding MailPoet's subscriber id, // this could be useful to fetch extra data from the WordPress user's meta for instance // e.g.: https://gist.github.com/benheu/cf9eb925b0e17e6dbd6c if ($tag_value === 'my_name') { $replacement = 'Maily'; } if ($tag_value === 'blog_name') { $replacement = get_bloginfo('name'); } if ($tag_value === 'eme_events') { $replacement = eme_get_events_list('limit=10'); } return $replacement; } add_filter('wysija_shortcodes', 'mailpoet_shortcodes_custom_filter',10 ,2);
`
Any help is most welcome…
Peter
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘display eventlist in Mailpoet Newsletters’ is closed to new replies.