Viewing 6 replies - 1 through 6 (of 6 total)
  • Hey Dan,
    The conditional placeholder checks to see if there is content assigned or not. Use it like a shortcode with any placeholder in the center:
    {has_image}#_EVENTIMAGE{/has_image}
    Or
    {has_image}#_EVENTIMAGE{100,100}{/has_image} This will show a thumbnail sized 100×100

    Harrison

    Thread Starter danhodkinson

    (@danhodkinson)

    in my template i am using:
    `<?php echo $EM_Event->output(‘#_EVENTIMAGE’);?>’
    to show an image.
    Using echo do shortcode in the template doesn’t seem to work.

    Dan

    Try any of these to see if any works:
    <?php echo $EM_Event->output('format'=>'<div>{has_image}#_EVENTIMAGE{/has_image}</div>');?>

    I usually use the below format in my templates but never tried the conditional placeholder in it.
    <?php if (class_exists(‘EM_Events’)) {
    echo EM_Events::output(‘format’=>'<div>{has_image}#_EVENTIMAGE{/has_image}</div>’);
    } ?>

    Tested both codes above and they don’t work. However this worked:

    <?php if (class_exists('EM_Events')) {
    	echo EM_Events::output( array('limit'=>0,'orderby'=>'start_date', 'category' => 13, 'format'=>'{has_image}#_EVENTIMAGE{/has_image}
    ') );
    } ?>

    You have to change the category id to the one you have there.

    Thread Starter danhodkinson

    (@danhodkinson)

    Thanks for that!

    i’ve found that
    <?php if ( $EM_Event->output('#_EVENTIMAGE') ) = ' '): ?>
    also works, so i’ll play about with both and see which i get along with

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    or

    $EM_Event->get_image_url() == ''

    might work better

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘using {has_image} in template’ is closed to new replies.