【发布时间】:2015-03-15 15:50:21
【问题描述】:
这里我有一个网站,tinywolf.uk,我目前正在开发。主页是一个独立于 wordpress 的静态站点,但站点 http://www.tinywolf.uk/blog 的博客部分将由 wordpress 提供支持。
我目前使用的是 251 主题,并且希望在博客的主页中也有页眉和页脚以保持连续性。
到目前为止,我已经创建了一个子主题,然后是一个包含主页标题的新 header.php 文件。这替换了现有的 wordpress header.php 并正确显示,但是,其余主题的样式已经消失。我想保持帖子的样式。
如何从二十五主题中调用正确的样式以确保内容(博客文章)的样式正确?
here 是我的子主题 header.php 代码
我尝试使用<link rel="stylesheet" 为二十五主题添加 style.css,尽管这会带来一些格式,但它也破坏了页面的结构。
这是我的functions.php的内容:
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/blog/wp-content/themes/twentyfifteen/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/blog/wp-content/themes/twentyfifteen/style.css',
array('parent-style')
);
}
?>
这是我的孩子 style.css:
/*
Theme Name: Tiny Theme Child
Theme URI: http://example.com/twenty-fifteen-child/
Description: Twenty Fifteen Child Theme
Author: Joel S
Author URI: http://www.tinywolf.uk/blog
Template: twentyfifteen
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: twenty-fifteen-child
*/
【问题讨论】:
标签: css wordpress header stylesheet