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; // Sort by update date and time. if ( !function_exists( 'ampbase_orderby_modified' ) ): function ampbase_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; // Register widget. if ( !function_exists( 'ampbase_widgets_init' ) ): function ampbase_widgets_init() { register_sidebar( array( 'name' => 'nav widget 1', 'id' => 'nav-widget-1', 'description' => 'nav-widget-1', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => 'nav widget 2', 'id' => 'nav-widget-2', 'description' => 'nav-widget-2', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); 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_widgets_init' ); endif; // Implement the Custom Header feature. $ampbase_custom_header_defaults = array( 'height' => 64, 'header-text' => false ); add_theme_support( 'custom-header', $ampbase_custom_header_defaults ); // Allow svg file. /* function ampbase_custom_mime_types( $mimes ) { $mimes['svg'] = 'image/svg+xml'; return $mimes; } add_filter( 'upload_mimes', 'ampbase_custom_mime_types' ); */ // Enable custom background. add_theme_support( 'custom-background' ); // Add callback for custom TinyMCE editor stylesheets. add_editor_style();