<?php
/**
* Plugin Name: !seomur custom CSS
* Description: Loads custom CSS from the plugin's /assets/custom-style.css
* Version: 1.0
* Author: seomur
* License: GPL2
*/
// Безопасность: запрещаем прямой доступ
defined('ABSPATH') || exit;
/**
* Loads custom CSS file from plugin assets
*/
function load_custom_css_from_plugin() {
$css_path = plugin_dir_path(__FILE__) . 'assets/custom-style.css';
// Проверяем существование файла перед подключением
if (!file_exists($css_path)) {
return;
}
$css_url = plugins_url('assets/custom-style.css', __FILE__);
wp_enqueue_style(
'custom-css-from-plugin',
$css_url,
array(), // без зависимостей
filemtime($css_path), // версия файла для кеша
'all' // медиа-тип
);
}
add_action('wp_enqueue_scripts', 'load_custom_css_from_plugin');

@seomur
Это сайт с моими заметками по wordpress и woocommerce