Nytt år, ny dag, nya möjligheter och nya buggar att lösa. När jag tittade till mina Wordpress-baserade sidor idag märkte jag att det var något underligt med copyrighttexten i sidfötterna, den ville inte riktigt visa det nya året.
function copyright_func($atts) {
extract(shortcode_atts(array(
'text' => 1,
'start' => strftime(date('Y')),
'copyright' => "©",
'owner' => get_bloginfo('name'),
), $atts));
$this_year = strftime(date('Y'));
if($text != 0):
$output = 'Copyright ';
endif;
if($start == $this_year):
$output .= "$copyright $start $owner";
return $output;
else:
$output .= "$copyright $start-$thisYear $owner";
return $output;
endif;
}
add_shortcode('copyright', 'copyright_func');
ska givetvis vara
function copyright_func($atts) {
extract(shortcode_atts(array(
'text' => 1,
'start' => strftime(date('Y')),
'copyright' => "©",
'owner' => get_bloginfo('name'),
), $atts));
$this_year = strftime(date('Y'));
if($text != 0):
$output = 'Copyright ';
endif;
if($start == $this_year):
$output .= "$copyright $start $owner";
return $output;
else:
$output .= "$copyright $start-$this_year $owner";
return $output;
endif;
}
add_shortcode('copyright', 'copyright_func');
$this_year hade i all hast blivit $thisYear på ett ställe. Gör en sökning i din functions.php och rätta till mitt misstag så ska även din sajt acceptera det nya året. Lycka till och gott nytt år!