使“二十一个”主题的标题不太高?
2 个回答
- 投票数
-
- 2010-08-17
要使"二十十"主题的标题变小(即,像素少的高度),请将此代码放在主题的"
functions.php
"文件的底部(请务必更改数字180
到您想要的高度):<?php add_action('twentyten_header_image_height','yoursite_header_image_height'); function yoursite_header_image_height($height) { return 180; // Modify this to whatever pixel height you want. }
然后,您需要在管理控制台中转到" 外观>标头"并上传新的较小图片(这是该管理页面的URL):
这是该管理页面的外观:
您还可以考虑对" 儿童主题"进行修改(如果尚未修改的话).这是一篇文章(过于复杂),但实际上就像在Web服务器上的"
/wp-content/themes/
"子目录下创建目录一样简单(我将其称为"/wp-content/themes/yoursite/
"),并在该目录中使用以下命令创建"style.css
":/* Theme Name: Your Child Theme Name Description: Theme for your-site.com Author: Your Name Version: 1.0 Template: twentyten */ @import url("../twentyten/style.css");
然后,您可以创建一个新的"
functions.php
"文件,并将上面的PHP代码放入其中,而无需修改TwentyTen主题目录中的文件,而必须再次进行处理二十点有安全更新时.To make the header on the Twenty Ten theme less tall (i.e. a height with fewer pixels) put this code at the bottom of your theme's "
functions.php
" file (being sure to change the number180
to whatever height you want):<?php add_action('twentyten_header_image_height','yoursite_header_image_height'); function yoursite_header_image_height($height) { return 180; // Modify this to whatever pixel height you want. }
Then you'll need to go to "Appearance > Header" in your admin console and upload your new smaller image (here's the URL to that admin page):
And here's what that admin page looks like:
You might also consider making your modifications on a "Child Theme" (if you have not already.) Here's an article (that is overly complicated) but it's really as simple as just creating a directory on your web server under the "
/wp-content/themes/
" subdirectory (I'd call it "/wp-content/themes/yoursite/
") and creating a "style.css
" in that directory with the following:/* Theme Name: Your Child Theme Name Description: Theme for your-site.com Author: Your Name Version: 1.0 Template: twentyten */ @import url("../twentyten/style.css");
Then you can create a new "
functions.php
" file and put the above PHP code in it rather than modifying the files in the directory of the TwentyTen theme and having to deal with doing it again it when Twenty Ten has a security update. -
问题是如何使"二十十"主题的标题变小?这个问题是在搜索引擎中隐藏的LinkedIn WordPress组中提出的,所以我想我应该复制我对这里的回答.
我也将其设置为社区Wiki,因此不会将声誉传递给我.