Он запускается даже на более крупных экранах. Проблема в том, что этот заголовок был создан как пользовательский блок и зарегистрирован в функциях. Но удивительные сценарии шрифтов зарегистрированы с использованием wp_enqueue_scripts () крюка. Я предполагаю, что, поскольку init Hook приоритет до того, как wp_enqueue_scripts () Hook, даже если у меня есть стили, чтобы не показывать значок на больших экранах, стили значков, поскольку зарегистрированные позже получают приоритет и отображаются на экране. Мне было интересно, есть ли другой способ зарегистрировать Font Awesome, чтобы этого не произошло. < /P>
Это моя функция.
Код: Выделить всё
function create_block_temp_block_block_init() {
/**
* Registers the block(s) metadata from the `blocks-manifest.php` and registers the block type(s)
* based on the registered block metadata.
* Added in WordPress 6.8 to simplify the block metadata registration process added in WordPress 6.7.
*
* @see https://make.wordpress.org/core/2025/03/13/more-efficient-block-type-registration-in-6-8/
*/
if ( function_exists( 'wp_register_block_types_from_metadata_collection' ) ) {
wp_register_block_types_from_metadata_collection( __DIR__ . '/build', __DIR__ . '/build/blocks-manifest.php' );
return;
}
/**
* Registers the block(s) metadata from the `blocks-manifest.php` file.
* Added to WordPress 6.7 to improve the performance of block type registration.
*
* @see https://make.wordpress.org/core/2024/10/17/new-block-type-registration-apis-to-improve-performance-in-wordpress-6-7/
*/
if ( function_exists( 'wp_register_block_metadata_collection' ) ) {
wp_register_block_metadata_collection( __DIR__ . '/build', __DIR__ . '/build/blocks-manifest.php' );
}
/**
* Registers the block type(s) in the `blocks-manifest.php` file.
*
* @see https://developer.wordpress.org/reference/functions/register_block_type/
*/
$manifest_data = require __DIR__ . '/build/blocks-manifest.php';
foreach ( array_keys( $manifest_data ) as $block_type ) {
register_block_type( __DIR__ . "/build/{$block_type}" );
}
}
add_action( 'init', 'create_block_temp_block_block_init' );
function university_files() {
wp_enqueue_style('custom-google-fonts', '//fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700,700i|Roboto:100,300,400,400i,700,700i');
wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
}
add_action('wp_enqueue_scripts', 'university_files');
Вот мой репозиторий GIT для справки:
https://github.com/revolter23/fictalal-lock-copy
Подробнее здесь: https://stackoverflow.com/questions/797 ... esome-icon
Мобильная версия