post_excerpt;
$content = $post->post_content;
if ($excerpt) {
return $excerpt;
} else {
$length = 120;
$content = preg_replace('/.+/is', "", $content);
$content = strip_shortcodes($content);
$content = strip_tags($content);
$content = str_replace(" ", "", $content);
$content = mb_substr($content, 0, $length);
return $content;
}
}
endif;
if ( !function_exists( 'orderby_modified' ) ):
function orderby_modified( $query ) {
if( $query->is_main_query() ) {
if( $query->is_home() || $query->is_category() || $query->is_archive() || $query->is_tag() ) {
$query->set( 'orderby', 'modified' );
}
}
}
add_action( 'pre_get_posts', 'ampbase\orderby_modified' );
endif;
// Widget
if ( !function_exists( 'theme_widgets_init' ) ):
function theme_widgets_init() {
register_sidebar( array(
'name' => 'nav top ad',
'id' => 'nav-top-ad',
'description' => 'nav top ad',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
) );
register_sidebar( array(
'name' => 'nav top amp ad',
'id' => 'nav-top-amp-ad',
'description' => 'nav top amp ad',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
) );
register_sidebar( array(
'name' => 'nav bottom ad',
'id' => 'nav-bottom-ad',
'description' => 'nav bopttom ad',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
) );
register_sidebar( array(
'name' => 'nav bottom amp ad',
'id' => 'nav-bottom-amp-ad',
'description' => 'nav bottom amp ad',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
) );
}
add_action( 'widgets_init', 'ampbase\theme_widgets_init' );
endif;
// Implement the Custom Header feature.
$custom_header_defaults = array(
'header-text' => false
);
add_theme_support( 'custom-header', $custom_header_defaults );
// Custom background
add_theme_support( 'custom-background' );
// Editor style
add_editor_style();