文件操作 - custom-css.php
返回文件管理
返回主菜单
删除本文件
文件: /root/Desktop/OLD/plugin-wordpress/master-addons/inc/modules/custom-css/custom-css.php
编辑文件内容
<?php namespace MasterAddons\Modules\CustomCSS; use Elementor\Plugin; use Elementor\Widget_Base; use Elementor\Controls_Manager; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Typography; use Elementor\Scheme_Color; use Elementor\Scheme_Typography; use Elementor\Control_Media; use Elementor\Group_Control_Border; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Background; /** * Author Name: Liton Arefin * Author URL: https://jeweltheme.com * Date: 1/2/20 */ if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly. class Master_Addons_Custom_CSS { /* * Instance of this class */ private static $instance = null; public function __construct() { // Add new controls to advanced tab globally add_action( "elementor/element/after_section_end", array( $this, 'jltma_add_section_custom_css_controls'), 25, 3 ); // Render the custom CSS if ( ! defined('ELEMENTOR_PRO_VERSION') ) { add_action( 'elementor/element/parse_css', array( $this, 'jltma_add_post_css' ), 10, 2 ); } } public function jltma_add_section_custom_css_controls( $widget, $section_id, $args){ if( 'section_custom_css_pro' !== $section_id ){ return; } if( ! defined('ELEMENTOR_PRO_VERSION') ) { $widget->start_controls_section( 'jltma_custom_css_section', array( 'label' => MA_EL_BADGE . __( ' Custom CSS', MELA_TD ), 'tab' => Controls_Manager::TAB_ADVANCED ) ); $widget->add_control( 'custom_css', array( 'type' => Controls_Manager::CODE, 'label' => __( 'Custom CSS', MELA_TD ), 'label_block' => true, 'language' => 'css' ) ); ob_start();?><pre> Examples: // To target main element selector { color: red; } // For child element selector .child-element{ margin: 10px; } </pre><?php $output = ob_get_clean(); $widget->add_control( 'custom_css_description', array( 'raw' => __( 'Use "selector" keyword to target wrapper element.', MELA_TD ). $output, 'type' => Controls_Manager::RAW_HTML, 'content_classes' => 'elementor-descriptor', 'separator' => 'none' ) ); $widget->end_controls_section(); } } public function jltma_add_post_css( $post_css, $element ) { $element_settings = $element->get_settings(); if ( empty( $element_settings['custom_css'] ) ) { return; } $css = trim( $element_settings['custom_css'] ); if ( empty( $css ) ) { return; } $css = str_replace( 'selector', $post_css->get_element_unique_selector( $element ), $css ); // Add a css comment $css = sprintf( '/* Start custom CSS for %s, class: %s */', $element->get_name(), $element->get_unique_selector() ) . $css . '/* End custom CSS */'; $post_css->get_stylesheet()->add_raw_css( $css ); } public static function get_instance() { if ( ! self::$instance ) { self::$instance = new self; } return self::$instance; } } Master_Addons_Custom_CSS::get_instance();
修改文件时间
将文件时间修改为当前时间的前一年
删除文件