Startpunkten
This commit is contained in:
72
functions.php
Normal file
72
functions.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
register_sidebar(array('name'=>'Sidebar 1',
|
||||
'before_widget' => '<div class="widget">',
|
||||
'after_widget' => '</div><!-- END WIDGET -->',
|
||||
'before_title' => '<h3>',
|
||||
'after_title' => '</h3>'));
|
||||
|
||||
register_sidebar(array('name'=>'Sidebar 2',
|
||||
'before_widget' => '<div class="widget">',
|
||||
'after_widget' => '</div><!-- END WIDGET -->',
|
||||
'before_title' => '<h3>',
|
||||
'after_title' => '</h3>'));
|
||||
|
||||
//Content Width
|
||||
// $content_width = 480;
|
||||
function gnorpen_human_time_diff( $from, $to = '' ) {
|
||||
if ( empty($to) )
|
||||
$to = time();
|
||||
$diff = (int) abs($to - $from);
|
||||
if ($diff <= 3600) {
|
||||
$mins = round($diff / 60);
|
||||
if ($mins <= 1) {
|
||||
$mins = 1;
|
||||
}
|
||||
/* translators: min=minute */
|
||||
$since = sprintf(_n('%s minut', '%s minuter', $mins), $mins);
|
||||
} else if (($diff <= 86400) && ($diff > 3600)) {
|
||||
$hours = round($diff / 3600);
|
||||
if ($hours <= 1) {
|
||||
$hours = 1;
|
||||
}
|
||||
$since = sprintf(_n('%s timme', '%s timmar', $hours), $hours);
|
||||
} elseif ($diff >= 86400) {
|
||||
$days = round($diff / 86400);
|
||||
if ($days <= 1) {
|
||||
$days = 1;
|
||||
}
|
||||
$since = sprintf(_n('%s dag', '%s dagar', $days), $days);
|
||||
}
|
||||
return $since;
|
||||
}
|
||||
function new_excerpt_more( $more ) {
|
||||
return ' <p><a class="read-more" href="'. get_permalink( get_the_ID() ) . '">' . 'Läs vidare →' . '</a></p>';
|
||||
}
|
||||
add_filter( 'excerpt_more', 'new_excerpt_more' );
|
||||
function excerpt_length( $length ) {
|
||||
return 100;
|
||||
}
|
||||
add_filter( 'excerpt_length', 'excerpt_length', 999 );
|
||||
|
||||
function GutenbergSupport() {
|
||||
|
||||
// Grundläggande block-editor-stöd
|
||||
add_theme_support('editor-styles');
|
||||
add_theme_support('wp-block-styles');
|
||||
add_theme_support('responsive-embeds');
|
||||
add_theme_support( 'widgets-block-editor' );
|
||||
add_theme_support( 'widgets' );
|
||||
add_theme_support( 'block-templates' );
|
||||
|
||||
// Tillåt breda och fullbreddsblock
|
||||
add_theme_support('align-wide');
|
||||
|
||||
// Stöd för featured images om det inte finns
|
||||
add_theme_support('post-thumbnails');
|
||||
|
||||
// Lägg till editor-styles (kommer i steg 2)
|
||||
add_editor_style('editor-style.css');
|
||||
}
|
||||
add_action('after_setup_theme', 'GutenbergSupport');
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user