文件操作 - functions.php
返回文件管理
返回主菜单
删除本文件
文件: /storage/v12552/steemteam/public_html/wp-content/themes/hello-elementor-child/functions.php
编辑文件内容
<?php if ( ! defined( 'ABSPATH' ) ) { exit; } add_action( 'wp_enqueue_scripts', function() { wp_enqueue_style( 'hello-elementor-child-style', get_stylesheet_uri(), [], wp_get_theme()->get( 'Version' ) ); } ); /** * Exclude JSON-LD schema blocks from GTranslate and browser auto-translation. * Adds translate="no" to all application/ld+json script tags sitewide. */ add_filter( 'script_loader_tag', function( $tag, $handle, $src ) { if ( strpos( $tag, 'application/ld+json' ) !== false ) { $tag = str_replace( '<script', '<script translate="no"', $tag ); } return $tag; }, 10, 3 ); /** * Add notranslate class and translate="no" to JSON-LD script tags * to prevent GTranslate JS from translating schema output. */ add_action( 'wp_head', function() { echo '<style>.notranslate { display: none !important; }</style>'; }, 1 ); add_filter( 'rank_math/json_ld', function( $data ) { return $data; }, 999 ); add_action( 'wp_footer', function() { ?> <script> document.addEventListener("DOMContentLoaded", function() { document.querySelectorAll('script[type="application/ld+json"]').forEach(function(el) { el.setAttribute('translate', 'no'); el.classList.add('notranslate'); }); }); </script> <?php }, 999 );
修改文件时间
将文件时间修改为当前时间的前一年
删除文件