我正在尝试为wordpress创建自定义主题,我创建了以下所有文件:
风格css索引。PHP功能。phpfooter。phpheader。PHP第页。phpsingle。PHP前页。php
这是我的风格代码。css:
/*
Theme name: La Pizzeria
Theme URI: http://www.matteoschiatti.it
Author: Matteo Schiatti
Author URI: http://www.matteoschiatti.it
Description: Theme for Restaurants
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/license/glp-2.0.html
Tags: restaurant, mobile first, responsive, pizza
Text Domain: lapizzeria;
*/
body {
background-color: #000;
}
.test {
color: red;
}
这是我的函数代码。php:
<?php
function lapizzeria_styles() {
//Adding stylesheets
wp_register_style(\'style\', get_template_directory_uri() . \'/style.css\', array(), \'1.0\');
//Enqueue the style
wp_enqueue_style(\'style\');
}
add_action(\'wp_enqueue_scripts\', \'lapizzeria_styles\');
这是我的标题的功能。php:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>La pizzeria</title>
<?php wp_head(); ?>
</head>
<body>
<span class="test">fdsafdsafdsafsdafsdafsdafdsafsa</span>
在其他文件中,代码中有:
<?php
get_header();
?>
<?php
echo "la pizzeria";
?>
<?php
get_footer();
?>
我不明白为什么是这种风格。css不起作用,标题被正确嵌入,因为我可以看到页面的标题,所以我认为函数中的函数存在一些问题。php文件。