160, 'width' => 160, )); register_nav_menus($this->menu_locations()); } public static function menu_locations() { return [ 'header_menu' => esc_html('Header Menu (show on page header)', SAKURA_TEXT_DOMAIN), ]; } public static function wp_rest_allow_all_cors() { // Remove the default filter. remove_filter('rest_pre_serve_request', 'rest_send_cors_headers'); // Add a Custom filter. add_filter('rest_pre_serve_request', function ($value) { header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE'); header('Access-Control-Allow-Credentials: true'); return $value; }); } public function changes_post_excerpt_more(string $more) { return ' ...'; } public function changes_post_excerpt_length(int $length) { return 120; } /** * Post view times counter * * @return void */ public function set_post_views() { if (is_singular()) { global $post; $post_id = intval($post->ID); if ($post_id) { $views = (int) get_post_meta($post_id, 'views', true); if (!update_post_meta($post_id, 'views', ($views + 1))) { add_post_meta($post_id, 'views', 1, true); } } } } }