Support » Plugin: Events Manager » Scissors & thumbnails in events_list

  • Resolved irmo

    (@irmo)


    Hello, i’m using Scissors & watermark plugin for autocrop all my images in standard formats,

    for single pages (editing templates) or custom loops i simply enable php and call the
    <?php the_post_thumbnail('thumbnail', array('class' => 'media-object thumbnail'));?>

    when instead i try to edit the events list templates i cant find a way to show the autocropped image in the lists

    ex.
    http://www.diventa.it/informale/eventi/categorie/aperattivi/

    in wich the code of: category_event_list_item_format.php
    is

    <?php $EM_Event = em_get_event($post->ID, 'post_id');?>
    
    <li class="span3">
    
    <?php
    $theid = ('#_EVENTPOSTID');
    the_post_thumbnail($theid,'thumbnail');
    ?>
    
    <a href="#_EVENTURL">
    #_EVENTNAME
    </a>
    </li>

    can someone help me?

    thx
    Pietro

    http://wordpress.org/extend/plugins/events-manager/

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Marcus

    (@netweblogic)

    NetWebLogic Support

    instead of $theid, why not just use $post->ID again?

    instead of $theid, why not just use $post->ID again?

    did it..
    now the code looks like:

    <?php $EM_Event = em_get_event($post->ID, 'post_id');?>
    
    <li class="span3">
    
    <?php
    echo get_the_post_thumbnail($post->ID,'thumbnail');
    ?>
    
    <a href="#_EVENTURL">
    #_EVENTNAME
    </a>

    the result is the same, no image loaded:
    http://www.diventa.it/informale/eventi/categorie/aperattivi/

    Plugin Author Marcus

    (@netweblogic)

    NetWebLogic Support

    another alternative, try using e.g.

    echo EM_Events::output(array('format'=>'<li class="span3">#_EVENTIMAGE{100,100}<a href="#_EVENTURL">
    #_EVENTNAME
    </a>'));

    another alternative, try using e.g.

    echo EM_Events::output(array('format'=>'<li class="span3">#_EVENTIMAGE{100,100}<a href="#_EVENTURL">
    #_EVENTNAME
    </a>'));

    mhh, this wont solve my problem, what i need is to get the “thumbnail” or “medium” auto cropping from wordpress thumbnail

    (setting:
    #_EVENTIMAGE{150,150} is different than setting
    thumbnail(‘medium’,args)
    )

    don’t know if this will help you but try this link http://wordpress.org/support/topic/how-to-crop-thumbnails-automatically?replies=7

    Plugin Author Marcus

    (@netweblogic)

    NetWebLogic Support

    are you sure you’re getting the right post id?

    i.e. try hard-coding a post id to make sure you’re getting an image.

    hardcoding an id works..

    if i code

    echo get_the_post_thumbnail(53,'thumbnail');
    //works showing event 53 thumbnail

    i get the image, same for all events but i get it

    if i code

    $theid = ('#_EVENTPOSTID');
    echo ' id of the post = ' . $theid
    //id of the post 53

    i get the right id (53, the same that shows the right image up here

    but if i code

    $theid = ('#_EVENTPOSTID');
    echo get_the_post_thumbnail($theid,'thumbnail');
    //nothing shown

    or

    echo get_the_post_thumbnail($post->ID,'thumbnail');
    //nothing shown

    i get nothing…

    that’s so strange..

    have you tried something like

    <?php
    global $post;
    $EM_Event = em_get_event($post->ID, 'post_id');
    ?>
    <?php echo $EM_Event->output('#_EVENTPOSTID'); ?>

    have you tried something like

    <?php
    global $post;
    $EM_Event = em_get_event($post->ID, ‘post_id’);
    ?>
    <?php echo $EM_Event->output(‘#_EVENTPOSTID’); ?>

    this gives me the id of the Category list page, not of the post into the “category loop”

    Plugin Author Marcus

    (@netweblogic)

    NetWebLogic Support

    ok, no I think I get your problem. $post isn’t the post id you want, i.e. you’re not in a loop of posts

    try something like

    foreach( EM_Event::get(array('category'=>'x'...)) as $EM_Event ){
     ...
    }

    just doing ('#_EVENTPOSTID') won’t do anything

    yes, this sounds right, i’ll test someting like this Asap

    (i never understood what kind of “loop” the EM list (category, event etc.) generates, if there’s not loop in them probably my whole approach is wrong

    PS: also if “echo (‘#_EVENTPOSTID’)” gives me right ID

    mhh.. nothing

    but i found a workaround:

    solved editing directly the category-single.php

    in this:

    <?php
    /*
     * This page displays a single event, called during the em_content() if this is an event page.
     * You can override the default display settings pages by copying this file to yourthemefolder/plugins/events-manager/templates/ and modifying it however you need.
     * You can display events however you wish, there are a few variables made available to you:
     *
     * $args - the args passed onto EM_Events::output()
     */
    global $EM_Category;
    /* @var $EM_Category EM_Category */
    // echo $EM_Category->output_single();
    ?>
    
    <?php
    
    echo $EM_Category->description;
    
    $currentslug = $EM_Category->slug;
    
    $today = date("o-m-d");
    
    $eventi = array(
    	'post_type' => 'event',
    	'meta_key' => '_event_start_date',
    	'orderby' => 'meta_value',
    	'order' => ASC,
    	'event-categories' => $currentslug,
    	'meta_query'  => array(
    		array(
    			'key'     => '_event_start_date',
    			'value'   => $today,
    			'compare' => '>=',
    			'type'    => 'DATE',
    			)
    		),
    	);
    
    $loop = new WP_Query( $eventi );
    ?>
    
    <div>
    	<ul>
    <?php
    while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <?php $EM_Event = em_get_event($post->ID, 'post_id');?>
    
    <?php $alternate = $alterncount % 2;?>
    
    <li class="span3 center">
    
    	<a class="thumbnail" href="<?php the_permalink();?>"><?php the_post_thumbnail('medium');?></a>
    
    	<a href="<?php the_permalink();?>"><h4 class="media-heading"><?php the_title();?></h4></a>
    
    </li>
    
    <?php
    $alterncount++;
    
    endwhile;
    ?>
    </ul>
    </div>

    i have only to enable pagination in it and it should work

    Ty

    Plugin Author Marcus

    (@netweblogic)

    NetWebLogic Support

    that’ll work… you probalby need to create your own pagination logic here

    still not sure why you need this though… you can do this with our placeholders, and if you want to use thumbnails from WP rather than using timthumb, you can enable this in

    Events > Settings > General > Performance Optimization

    i tryed to disable thimbthumb.. but it wont let me select wat wordpress resolution (large, full, thumbnail, medium etc.) i want, and each image has 3 different “crop” (rectangular, vertical, square) premade for those

    if i could use #_EVENTIMAGE(medium) instead of #_EVENTIMAGE(150×150) i wouldnt need this workaround,

    but the “medium” size is a preset crop of the image in the area that i needed,
    the 150×150 instead just resizes (or crops in the center) the original image

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Scissors & thumbnails in events_list’ is closed to new replies.