Правильное подключение дополнительных стилей дочерней темы
-
Есть два кода, оба работают. Какой грамотнее, правильнее и быстрее будет работать?
1<?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', 20); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style',get_stylesheet_directory_uri() . '/style.css',array('parent-style') ); wp_enqueue_style( 'child-style-mobile',get_stylesheet_directory_uri() . '/stylemobile.css',array('parent-style', 'child-style') ); }
и 2
<?php // Exit if accessed directly if ( !defined( 'ABSPATH' ) ) exit; // BEGIN ENQUEUE PARENT ACTION // AUTO GENERATED - Do not modify or remove comment markers above or below: if ( !function_exists( 'chld_thm_cfg_parent_css' ) ): function chld_thm_cfg_parent_css() { wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css', array( ) ); } endif; add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css', 10 ); if ( !function_exists( 'child_theme_configurator_css' ) ): function child_theme_configurator_css() { wp_enqueue_style( 'chld_thm_cfg_separate', trailingslashit( get_stylesheet_directory_uri() ) . 'stylemobile.css', array( 'chld_thm_cfg_parent','easywp-maincss','font-awesome' ) ); } endif; add_action( 'wp_enqueue_scripts', 'child_theme_configurator_css', 20 ); // END ENQUEUE PARENT ACTION
Страница, с которой нужна помощь: [войдите, чтобы увидеть ссылку]
Просмотр 6 ответов — с 1 по 6 (всего 6)
Просмотр 6 ответов — с 1 по 6 (всего 6)
- Тема «Правильное подключение дополнительных стилей дочерней темы» закрыта для новых ответов.