简体   繁体   English

更改了我的style.css文件-没有任何反应

[英]Changed my style.css file - Nothing happened

I'm trying to create a wordpress theme and I'm coding on my local server using xampp. 我正在尝试创建wordpress主题,并且正在使用xampp在本地服务器上进行编码。

After about 10 hours of pulling my hair out trying to fix errors I finally figure out how to get my theme uploaded, and changes that I make to the style.css file aren't being applied. 经过大约10个小时的努力尝试修复错误后,我终于弄清楚了如何上传主题,并且没有应用对style.css文件所做的更改。

It uploads perfectly fine and I even tried changing the php files and that seemed to work fine. 它上传完全正常,我什至尝试更改php文件,而且看起来工作正常。

Any suggestions? 有什么建议么?

PS. PS。 This is my css code 这是我的CSS代码

 * { margin: 0px; padding: 0px; font: 13px Tahoma; } body,div,hgroup { display: block; } body { text-align: center; width: 100%; display: -webkit-box; -webkit-box-pack: center; background-color: blue; } #wrapper{ display: -webkit-box; margin-bottom: 15px; -webkit-box-flex: 1; -webkit-box-orient: vertical; border: 1px a2a2a2 solid; width: 90%; text-align: left; } #header { font: 65px Tahoma; border: 2px #a2a2a2 solid; } #content { width: 75%; border: 2px #a2a2a2 solid; float: left; } #sidebar { width: 23%; border: 2px #a2a2a2 solid; float: right; } /*#delimiter { clear: both; }*/ #footer { border: 2px #a2a2a2 solid; } /*.title { font-size: 11pt; font-family: verdana; font-weight: bold; }*/ 

You answered your own question in the comments, but for anyone who stumbles upon this; 您在评论中回答了自己的问题,但对于那些偶然发现此问题的人而言;

You should always load WordPress Stylesheets and JS files "the Wordpress way" as noted in the Theme Handbook 主题手册中所述,您应始终以“ Wordpress方式”加载WordPress样式表和JS文件。

Wordpress uses custom routing that requires you to load the Stylesheets from the theme directory. WordPress使用自定义路由,这要求您从主题目录加载样式表。 Rather than trying to use a relative URL like /style.css Or style.css always follow the guide linked above and use the wp_enqueue_style() function with either get_stylesheet_uri(); 而不是尝试使用相对的URL,例如/style.cssstyle.css始终遵循上面链接的指南,并在wp_enqueue_style()使用wp_enqueue_style()函数get_stylesheet_uri(); or get_template_directory_uri(); get_template_directory_uri(); to locate the file. 查找文件。

Edit: Note that those are not the only two functions that can be used to locate the stylesheet. 编辑:请注意,这些不是可用于查找样式表的仅有的两个功能。 As noted above you can also use the get_bloginfo() or bloginfo() functions and pass one of the many parameters that accepts. 如上所述,您还可以使用get_bloginfo()bloginfo()函数并传递接受的许多参数之一。 Read about that in the codex . 法典中阅读有关内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM