Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Plain Text by lol ( 12 years ago )
//COLUMNS
// Initiating query
$custom_query2 = new WP_query();
$columns= array();
if($tempera_columnNumber>0):
// Switch for Query type
switch ($tempera_columnType) {
case 'Latest Posts' :
$custom_query2->query('showposts='.$tempera_columnNumber.'&ignore_sticky_posts=1');
break;
case 'Random Posts' :
$custom_query2->query('showposts='.$tempera_columnNumber.'&orderby=rand&ignore_sticky_posts=1');
break;
case 'Latest Posts from Category' :
$custom_query2->query('showposts='.$tempera_columnNumber.'&category;_name='.$tempera_columnCateg.'&ignore_sticky_posts=1');
break;
case 'Random Posts from Category' :
$custom_query2->query('showposts='.$tempera_columnNumber.'&category;_name='.$tempera_columnCateg.'&orderby=rand&ignore_sticky_posts=1');
break;
case 'Sticky Posts' :
$custom_query2->query(array('post__in' => get_option( 'sticky_posts' ), 'showposts' =>$tempera_columnNumber,'ignore_sticky_posts' => 1));
break;
case 'Specific Posts' :
// Transofm string separated by commas into array
$pieces_array = explode(",", $tempera_columnSpecific);
$custom_query2->query(array( 'post_type' => 'any', 'post__in' => $pieces_array, 'ignore_sticky_posts' => 1,'orderby' => 'post__in' ));
break;
case 'Widget Columns':
break;
case 'Disabled':
break;
}//switch
endif; // columnNumber>0
// switch for reading/creating the columns
switch ($tempera_columnType) {
case 'Disabled':
break;
case 'Widget Columns':
// if widgets loaded
if (is_active_sidebar('presentation-page-columns-area')) {
echo "<div id='front-columns'>";
dynamic_sidebar( 'presentation-page-columns-area' );
echo "</div>";
}
// if no widgets loaded use the defaults
else {
global $tempera_column_defaults;
tempera_columns_output($tempera_column_defaults,$tempera_nrcolumns, $tempera_columnreadmore);
}
break;
default:
if($tempera_columnNumber>0):
if ( $custom_query2->have_posts() )
while ($custom_query2->have_posts()) :
$custom_query2->the_post();
$img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ),'columns');
$column['image'] = $img[0];
$column['link'] = get_permalink();
$column['text'] = get_the_excerpt();
$column['title'] = get_the_title();
$columns[] = $column;
endwhile;
tempera_columns_output($columns,$tempera_nrcolumns, $tempera_columnreadmore);
endif; // columnNumber>0
break;
}; // switch
function tempera_columns_output($columns,$nr_columns,$readmore){
$counter=0; ?>
<div id="front-columns"><?php
foreach($columns as $column):
if($column['image']) : $counter++;?>
<div class="column<?php echo ($counter%$nr_columns)?$counter%$nr_columns:$nr_columns; ?>">
<a href="<?php echo esc_url($column['link']) ?>">
<?php if ($column['title']) { echo "<h3 class='column-header-image'>".$column['title']."</h3>"; } ?>
</a>
<?php if ($column['image']) { ?>
<div class="column-image">
<div class="column-image-inside"> </div>
<img src="<?php echo esc_url($column['image']) ?>" id="columnImage<?php echo $counter; ?>" alt="" />
<?php if ($column['text']) { ?>
<div class="column-text">
<?php echo wp_kses_data($column['text']); ?>
</div>
<?php if($readmore && $column['link'] ): ?>
<div class="columnmore">
<a href="<?php echo esc_url($column['link']) ?>"><?php echo esc_attr($readmore) ?> <i class="column-arrow"></i> </a>
</div>
<?php endif; ?>
<?php } ?>
</div><!--column-image-->
<?php } ?>
</div><?php endif; // if image
endforeach; ?>
</div> <?php
} // tempera_columns_readmore
Revise this Paste