php - WordPress子主题不覆盖更改
问题描述
我的 WordPress 安装中有两个主题,theme1
和theme1-child
(设置为活动)。
有一部分theme1
我想编辑,theme1/inc/templates/post-meta.php
if ( ! function_exists( 'theme1_entry_date' ) ) :
function theme1_entry_date( $echo = true ) {
if ( has_post_format( array( 'chat', 'status' ) ) )
$format_prefix = _x( '%1$s on %2$s', '1: post format name. 2: date', 'theme1' );
else
$format_prefix = '%2$s';
$date = sprintf( __( ' on ', 'theme1' ) . '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>',
esc_url( get_permalink() ),
esc_attr( sprintf( __( 'Permalink to %s', 'theme1' ), the_title_attribute( 'echo=0' ) ) ),
esc_attr( get_the_date( 'c' ) ),
esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) )
);
if ( $echo )
echo $date;
return $date;
}
endif;
style.css
/*
Theme Name: Theme1 Child
Theme URI: http://www.url.com
Description: This is a child theme for Theme1.
Author: Author
Author URI: http: //www.url.com
Template: theme1
Version: 1.0
*/
@import url("../theme1/style.css");
div.woocommerce-tabs ul.tabs{display:none !important;}
html body .resp-tabs-container {margin-bottom: 30px;}
@media screen and (min-width: 800px) {
html body div.resp-tab-content {
padding: 10px !important;
}
}
所以我重新创建了这个文件,并在: 中进行了修改theme1-child/inc/templates/post-meta.php
,但是没有显示修改。
任何想法为什么这不接受变化?
解决方案
您需要将theme1_entry_date函数粘贴到您的子主题functions.php文件中。
谢谢
推荐阅读
- machine-learning - 如何计算深度学习目标检测中的真阳性(TP)?
- php - 是否可以使用从 PHP 中的 SQL 提取的数据将默认选择添加到在 for 循环中生成的下拉菜单中?
- android - 无法在 android 11 的 /storage/emulated/0/Android/data/myproject.data/data 中创建目录
- python-chess - 合法用户使用 python-chess 移动
- python - 使用 SeleniumRequest 时遇到 scrapy-selenium 库的问题
- javascript - 我在使用 .play 函数时遇到了一些问题 javascript
- dask - 在旧工人死亡后添加新工人时,如何重新提交 dask 工作(来自以前死去的工人)?
- flutter - 从表日历颤动中获取选定日期的值数据表
- mysql - Mysql 5.7 - 如何执行需要前一个子查询结果的多个子查询?
- reactjs - 创建反应应用程序时如何解决套接字超时