Exemple #1
0
 function widget($args, $instance)
 {
     $tempera_nrcolumns = $this->temperas['tempera_nrcolumns'];
     // getting the number of columns setting
     global $tempera_column_counter;
     // global counter for incrementing col count
     $blank = "";
     if ($instance['blank']) {
         $blank = "target='_blank'";
     }
     if ($instance['image']) {
         $tempera_column_counter++;
         // incrementing counter only if widget has image
         $counter = $tempera_column_counter;
         $coldata = array('colno' => $counter % $tempera_nrcolumns ? $counter % $tempera_nrcolumns : $tempera_nrcolumns, 'counter' => $counter, 'image' => esc_url($instance['image']), 'link' => esc_url($instance['link']), 'blank' => $instance['blank'] ? 'target="_blank"' : '', 'title' => $instance['title'], 'text' => $instance['text'], 'readmore' => $this->temperas['tempera_columnreadmore']);
         tempera_singlecolumn_output($coldata);
     }
 }
function tempera_columns($columns, $nr_columns, $readmore)
{
    $counter = 0;
    $temperas = tempera_get_theme_options();
    foreach ($temperas as $key => $value) {
        ${"{$key}"} = $value;
    }
    ?>
 <div id="front-columns"> 
 <?php 
    foreach ($columns as $column) {
        if ($column['image']) {
            $counter++;
            if (!isset($column['blank'])) {
                $column['blank'] = 0;
            }
            $coldata = array('colno' => $counter % $nr_columns ? $counter % $nr_columns : $nr_columns, 'counter' => $counter, 'image' => esc_url($column['image']), 'link' => esc_url($column['link']), 'blank' => $column['blank'] ? 'target="_blank"' : '', 'title' => wp_kses_data($column['title']), 'text' => wp_kses_data($column['text']), 'readmore' => wp_kses_data($readmore));
            tempera_singlecolumn_output($coldata);
        }
    }
    ?>
</div><?php 
}