WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Scissors & thumbnails in events_list (17 posts)

  1. irmo
    Member
    Posted 1 year ago #

    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/

  2. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

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

  3. irmo
    Member
    Posted 1 year ago #

    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/

  4. agelonwl
    Member
    Posted 1 year ago #

  5. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    another alternative, try using e.g.

    echo EM_Events::output(array('format'=>'<li class="span3">#_EVENTIMAGE{100,100}<a href="#_EVENTURL">
    #_EVENTNAME
    </a>'));
  6. irmo
    Member
    Posted 1 year ago #

    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)
    )

  7. agelonwl
    Member
    Posted 1 year ago #

  8. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    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.

  9. irmo
    Member
    Posted 1 year ago #

    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..

  10. agelonwl
    Member
    Posted 1 year ago #

    have you tried something like

    <?php
    global $post;
    $EM_Event = em_get_event($post->ID, 'post_id');
    ?>
    <?php echo $EM_Event->output('#_EVENTPOSTID'); ?>
  11. irmo
    Member
    Posted 1 year ago #

    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"

  12. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    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

  13. irmo
    Member
    Posted 1 year ago #

    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

  14. irmo
    Member
    Posted 1 year ago #

    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

  15. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    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

  16. irmo
    Member
    Posted 1 year ago #

    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(150x150) i wouldnt need this workaround,

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

  17. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    actually, what happens is WP choosed the closest image to that size (between your large/medium/small images) and then resizes it further according to the supplied size to #_EVENTIMAGE

    further to that, you could try adding extra placeholders e.g.#_EVENTIMAGELARGE

    http://wp-events-plugin.com/tutorials/create-a-custom-placeholder-for-event-formatting/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic