Skip to content

Commit

Permalink
freiland: fix mainevent banner link
Browse files Browse the repository at this point in the history
  • Loading branch information
cherbst committed Aug 23, 2012
1 parent e917551 commit e10e706
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion wordpress/wp-content/themes/freiland/functions.php
Expand Up @@ -440,6 +440,7 @@ function freiland_get_mainevent_banner(){
$today = strtotime(date('Y-m-d'));
$next_time = null;
$post = null;
$next_post = null;
foreach ( $ids as $id ){
$attachment = get_post($id);
if ( !$attachment ) continue;
Expand All @@ -451,12 +452,13 @@ function freiland_get_mainevent_banner(){
if ( $cur_time >= $today && ( $next_time == null || $cur_time <= $next_time ) ){
$next_id = $id;
$next_time = $cur_time;
$next_post = $post;
}
}
if ( !$next_id) return;
$image = wp_get_attachment_image( $next_id,
'full',false,array('class' => 'aligncenter' ) );
return '<a href="'. get_permalink( $post->ID) .'">' . $image . '</a>';
return '<a href="'. get_permalink( $next_post->ID) .'">' . $image . '</a>';
}

function freiland_get_news_banner(){
Expand Down

0 comments on commit e10e706

Please sign in to comment.