instead of $theid, why not just use $post->ID again?
Thread Starter
irmo
(@irmo)
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/
another alternative, try using e.g.
echo EM_Events::output(array('format'=>'<li class="span3">#_EVENTIMAGE{100,100}<a href="#_EVENTURL">
#_EVENTNAME
</a>'));
Thread Starter
irmo
(@irmo)
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)
)
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.
Thread Starter
irmo
(@irmo)
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'); ?>
Thread Starter
irmo
(@irmo)
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”
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
Thread Starter
irmo
(@irmo)
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
Thread Starter
irmo
(@irmo)
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
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
Thread Starter
irmo
(@irmo)
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