<?php
/**
 * @package WordPress
 * @subpackage Campoal
 */

$id = get_the_ID();
$link = get_permalink($id);
$title = get_the_title($id);
$author_link = get_author_posts_url(get_the_author_meta('ID'), get_the_author_meta('user_nicename'));

$supporter_number = conikal_get_supporter_donors_number($id);
$goal = $supporter_number->goal;
$sign = $supporter_number->sign;

// get post thumbnail
$thumbnail = conikal_get_petition_thumbnail($id, 'thumbnail');
$thumbnail_retina = conikal_get_petition_thumbnail($id, 'thumbnail-retina');

$lazy_placeholder = conikal_lazy_load_placeholder('thumbnail-square');
?>

<div class="item">
    <a class="ui tiny rounded image" href="<?php echo esc_url($link) ?>" data-bjax>
        <img class="lazy" data-src="<?php echo esc_url($thumbnail) ?>" data-retina="<?php echo esc_url($thumbnail_retina) ?>" src="<?php echo esc_url($lazy_placeholder) ?>" alt="<?php echo esc_attr($title) ?>" />
    </a>
    <div class="content">
        <a href="<?php echo esc_url($link) ?>" data-bjax><strong><?php echo esc_html($title) ?></strong></a>
        <div class="meta"><?php echo conikal_custom_icon('supporter') . ' ' . sprintf($supporter_number->label, esc_html(conikal_format_number('%!,0i', $sign, true))); ?></div>
    </div>
</div>
