• Resolved seanriceaz

    (@seanriceaz)


    I am using this plugin and qTranslate on a site. I found that on the calendar view, #_EVENTLINK was rendering some of the qTranslate quick tags to the browser.

    I fixed the issue by changing

    case '#_EVENTLINK': //HTML Link
    					$event_link = esc_url($this->get_permalink());
    					if($result == '#_LINKEDNAME' || $result == '#_EVENTLINK'){
    						$replace = '<a href="'.$event_link.'" title="'.esc_attr($this->event_name).'">'.esc_attr($this->event_name).'</a>'; 
    
                                            }else{
    						$replace = $event_link;
    					}
    					break;

    to

    case '#_EVENTLINK': //HTML Link
    					$event_link = esc_url($this->get_permalink());
    					if($result == '#_LINKEDNAME' || $result == '#_EVENTLINK'){
    
    					        $replace = '<a href="'.$event_link.'" title="'.$this->event_name.'">'.$this->event_name.'</a>';
                                            }else{
    						$replace = $event_link;
    					}
    					break;

    in /classes/em-event.php.
    Is there a way you could set up a qTranslate compatibility mode that would allow me to toggle this change in the admin (without editing your core code)? Basically, it just removes the esc_Attr() filter so qTranslate can detect its special tags and run its own filter.

    Thanks!

    https://www.ads-software.com/extend/plugins/events-manager/

Viewing 10 replies - 1 through 10 (of 10 total)
  • basically, you can try to override that placeholder as stated in this link https://wp-events-plugin.com/tutorials/modifying-placeholder-default-information/ and put your function somewhere e.g. theme function

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    if qTranslate is screwing with the esc_attr, you need to raise this with that plugin, it’s a standard wp function that I wouldn’t want to remove in the core, if anything I’ll be adding more if possible! (you could try to override it as angelo says)

    I had the same problem, but this solution did not work for me – it simply displayed all the language variants of the title.

    Instead, the trick is to apply ‘the_title’ filters to the event title before letting Events Manager escape it.
    I found the fix here: https://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=3365

    Here is my variant:

    add_filter('em_event_output_placeholder','slw_em_eventlink_mod',1,3);
    function slw_em_eventlink_mod($replace, $EM_Event, $result, $target){
    
            switch ($result) {
                    case '#_LINKEDNAME': //Depreciated
                    case '#_EVENTLINK': //HTML Link
    
                            if ( preg_match('~<\!--:([A-Za-z]*?)-->~', $replace) ) {
    
                                    // This is the fix: Apply the_title filter to the event name before letting Events Manager code muck with it
                                    $event_name = apply_filters('the_title', $EM_Event->event_name);
    
                                    $event_link = esc_url($EM_Event->get_permalink());
                                    $replace = '<a href="'.$event_link.'" title="'.esc_attr($event_name).'">'.esc_attr($event_name).'</a>';
                            }
                            break;
                    default:
            }
    
            return $replace;
    }

    Where do I put the code in order to get it to work?

    `add_filter(’em_event_output_placeholder’,’slw_em_eventlink_mod’,1,3);
    function slw_em_eventlink_mod($replace, $EM_Event, $result, $target){

    switch ($result) {
    case ‘#_LINKEDNAME’: //Depreciated
    case ‘#_EVENTLINK’: //HTML Link

    if ( preg_match(‘~<\!–:([A-Za-z]*?)–>~’, $replace) ) {

    // This is the fix: Apply the_title filter to the event name before letting Events Manager code muck with it
    $event_name = apply_filters(‘the_title’, $EM_Event->event_name);

    $event_link = esc_url($EM_Event->get_permalink());
    $replace = ‘<a href=”‘.$event_link.'” title=”‘.esc_attr($event_name).'”>’.esc_attr($event_name).'</a>’;
    }
    break;
    default:
    }

    return $replace;
    }`

    you can paste that in your theme functions.php

    Do you know how to fix the same problem with a title and descriptions on full-calendar?

    https://www.ads-software.com/extend/plugins/wp-fullcalendar/

    Sorry Antena, I don’t know how to fix it in full Calendar.
    I took a quick look at their code and found this code which seems like it is getting the title:

    $title = $post->post_title;
    $items[] = array (“title” => $title, “color” => $color, “start” => date(‘Y-m-d\TH:i:s’, $post_timestamp), “end” => date(‘Y-m-d\TH:i:s’, $post_timestamp), “url” => get_permalink($post->ID), ‘post_id’ => $post->ID );

    You can try adding this line in between those two:
    $title = apply_filters(‘the_title’, $title);

    No guarantees it will do the job.
    Also, you will be changing the core code of the plugin – so your changes will get overwritten with the next upgrade.

    You might want to post the question in the support forum for Full Calendar

    Thanks a lot. You’re right. I’ll try to find a solution on their forums.

    I have one more question.

    This work for every part except on a Calendar widget (a small calendar on sidebar):

    add_filter(’em_event_output_placeholder’,’slw_em_eventlink_mod’,1,3);
    function slw_em_eventlink_mod($replace, $EM_Event, $result, $target){

    switch ($result) {
    case ‘#_LINKEDNAME’: //Depreciated
    case ‘#_EVENTLINK’: //HTML Link

    if ( preg_match(‘~<\!–:([A-Za-z]*?)–>~’, $replace) ) {

    // This is the fix: Apply the_title filter to the event name before letting Events Manager code muck with it
    $event_name = apply_filters(‘the_title’, $EM_Event->event_name);

    $event_link = esc_url($EM_Event->get_permalink());
    $replace = ‘‘.esc_attr($event_name).’‘;
    }
    break;
    default:
    }

    return $replace;
    }

    I use for a Calendar widget – event title (alt on hover): #_EVENTNAME, #_CATEGORYNAME, #_EVENTEXCERPT, #_EVENTDATES, #_EVENTTIMES
    and have a problem with a translate #_EVENTNAME and #_EVENTEXCERPT.

    #_EVENTNAME is important for a small calendar, #_EVENTEXCERPT if it can.

    Thank you very much for help

    hi,

    you can add case '#_EVENTNAME': and case '#_EVENTEXCERPT': in the snippet above and just follow the code pattern but for #_EVENTEXCERPT it’s $EM_Event->post_excerpt

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: Events Manager] #_EVENTLINK and qTranslate’ is closed to new replies.