• Resolved christophe971

    (@christophe971)


    Dear Developers,

    I wish to add a conditional placeholder for the location image. I know there is already one for the event image, but I’m not able to write a similar one for the location image.
    This would then work like {has_location_image}content{/has_location_image}, if possible.

    Could you help me?
    Many thanks,

    Christophe

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    You can use
    {has_location_image}
    content
    {/has_location_image}

    function my_em_custom_category_output_condition($show_condition, $condition, $match,  $EM_Event){
        if( is_object( $EM_Event) && preg_match('/^has_location_image/',$condition, $matches) ){       
            $location_post = $EM_Event->get_location()->post_id;        
            $show_condition = has_post_thumbnail(  $location_post ) ? true : false;
    
        }
        return $show_condition;
    }
    add_filter('em_event_output_show_condition', 'my_em_custom_category_output_condition', 100, 4);
    • This reply was modified 3 years, 4 months ago by chathuripxl.
    Thread Starter christophe971

    (@christophe971)

    Great and thanks!

    I have tried some approaching code but the line

    $show_condition = has_post_thumbnail( $location_post ) ? true : false;

    saves my life!

    Christophe

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional placeholder for location image’ is closed to new replies.