%s', esc_attr( sprintf( __( 'Изменить: %s', 'smilia-core' ), get_the_title( $post_id ) ) ), esc_html__( 'Изменить', 'smilia-core' ) ); } public static function trail( ?WP_Post $post = null ): array { $post = $post ?? get_post(); if ( ! $post instanceof WP_Post ) { return array(); } $home = function_exists( 'pll_home_url' ) ? pll_home_url() : home_url( '/' ); $trail = array( array( 'title' => __( 'Home' ), 'url' => $home, ), ); if ( (int) get_option( 'page_on_front' ) === $post->ID || ( function_exists( 'pll_get_post' ) && (int) pll_get_post( (int) get_option( 'page_on_front' ) ) === $post->ID ) ) { return $trail; } foreach ( array_reverse( get_post_ancestors( $post ) ) as $ancestor ) { $trail[] = array( 'title' => get_the_title( $ancestor ), 'url' => get_permalink( $ancestor ), ); } $trail[] = array( 'title' => get_the_title( $post ), 'url' => get_permalink( $post ), ); return $trail; } public static function wave(): void { echo ''; } public static function asset( string $path ): string { $url = plugins_url( 'assets/img/' . $path, SMILIA_CORE_FILE ); $file = SMILIA_CORE_DIR . '/assets/img/' . $path; return is_readable( $file ) ? add_query_arg( 'ver', (string) filemtime( $file ), $url ) : $url; } public static function asset_svg( string $path, string $class_name = '', string $alt = '', string $loading = 'lazy' ): void { Picture::svg( SMILIA_CORE_DIR . '/assets/img/' . $path, self::asset( $path ), $class_name, $alt, $loading ); } public static function image( int $attachment_id, string $size, string $sizes, array $attr = array() ): void { if ( $attachment_id <= 0 ) { return; } echo wp_get_attachment_image( $attachment_id, $size, false, array_merge( array( 'sizes' => $sizes, 'decoding' => 'async', 'loading' => 'lazy', ), $attr ) ); } }