站长百科 | 数字化技能提升教程 数字化时代生存宝典
首页
数字化百科
电子书
▼
建站程序
开发
服务器
办公软件
开发教程
▼
服务器教程
软件使用教程
运营教程
热门电子书
▼
CSS教程
WordPress教程
导航
程序频道
推广频道
网赚频道
人物频道
网站程序
网页制作
云计算
服务器
CMS
论坛
网店
虚拟主机
cPanel
网址导航
WIKI使用导航
WIKI首页
热点词条
最新资讯
网站程序
站长人物
页面分类
使用帮助
编辑测试
创建条目
网站地图
站长百科导航
站长百科
主机侦探
IDCtalk云说
跨境电商导航
WordPress啦
站长专题
网站推广
网站程序
网站赚钱
虚拟主机
cPanel
网址导航专题
云计算
微博营销
虚拟主机管理系统
开放平台
WIKI程序与应用
美国十大主机
编辑“
WordPress:Codex:Styles
”(章节)
人物百科
|
营销百科
|
网赚百科
|
站长工具
|
网站程序
|
域名主机
|
互联网公司
|
分类索引
跳转至:
导航
、
搜索
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
===在Codex中使用代码=== Displaying programming codes, HMTL, and CSS is common within the WordPress Codex. It can be styled in several different ways. 在WordPress Codex中使用程序代码,HTML和CSS很常见。可以以不同的方式显示。 ;Code within the text :To style code within the text of an article, such as listing the <tt>index.php</tt> template file, use the <tt><tt></tt> tag to wrap the code within a sentence. Do not use the <tt><code></tt> tag as it <code>puts a blue background behind the text which makes it a little hard to read.</code> Using the <tt><tt></tt> tag in a <tt>sentence removes the blue background and makes it easier to read</tt>. ;文本内的代码:在一篇文章的文本内设计代码,如列出<tt>index.php</tt>模板文件,请使用<tt><tt></tt>标签将代码包裹在句子中。不要使用<tt><code></tt>标签,因为这个标签<code>在文本的背后创建了蓝色的背景色,这样使得文本较难阅读。在</code> <tt>句子中使用<tt><tt></tt> 标签,会移除文本后面的蓝色背景色,使得文本便于阅读</tt>。 ;Code in a PRE tag :To style code so it is separate from the text and highlighted in a blue colored background container, use <tt><pre></tt> tags to surround the code. Do not use <tt><tt></tt> or <tt><code></tt> within the PRE tags unless you want to show those tags. If using a link within a PRE tag, use <tt><nowiki></tt> to force the link to not generate into an active link. ;PRE标签中的代码:设计代码这样代码从文本中分开,突出在一个蓝色背景的container中,请使用<tt><pre></tt>标签包围代码。不要在PRE标签内部使用<tt><tt></tt>或者<tt><code></tt>,除非你想要显示这些标签。如果在PRE标签内部使用链接,请使用<tt><nowiki></tt>迫使链接不会变为活跃的链接。 ;PRE Shortcut :If you are writing a ''very short line'' of code, you can put a space before the code and the software will automatically generate a <tt><pre></tt> tag around the code. ;PRE Shortcut :如果你正在编写''非常短的''代码,你可以在代码之前放置空格,这样软件会在代码的周围自动创建<tt><pre></tt>标签。 ;PRE Limits :The <tt><pre></tt> tag is great for highlighting text, but it still functions the same as any HTML <tt><pre></tt> tag. The layout of the code within a <tt><pre></tt>, with tabs, spaces, and long lines, will all be evident. Long lines that exceed the width of the page will run off the page. When possible, force line breaks in the code to shorten the width manually. When not possible (it will break the code if copied and pasted exactly as written), then use your best judgment. Avoid huge indentions and tabs to push the code over. Use two or more spaces rather than tabs for long lines of code to provide indention. ;PRE Limits : <tt><pre></tt>标签能够很好的突出文本,但是这个标签与任何HTML<tt><pre></tt>标签运行方式仍然是相同的。<tt><pre></tt内的代码布局,标签,空格,长行,都很明显。超过页面宽度的长行会从页面上消失。如果可能,迫使代码分行,动手缩短代码行的宽度。如果不能够这样做(这样会破坏代码复制粘贴时的格式),请自己判断。避免大的缩排和跳格设定破坏代码。为长行的代码使用两个或者多个空格而不是跳格设定,来设置缩排。 ;Wrapping Code :Using the example below, you can create a div styled with CSS to emulate the <tt><pre></tt> tag usage, but the code will be actually text within a container, made to look like code through the use of <tt><tt></tt> and changing > and < into <tt>&gt;</tt> and <tt>&lt;</tt> and line breaks <tt><br /></tt> within the code example. The benefit of this style is that the code will automatically wrap when a space is used, allowing longer lengths of code to be showcased. ;Wrapping Code :使用下面的例子,你可以使用CSS创建div,效仿<tt><pre></tt>标签用法,但是代码将会是container内的真正的文本,通过使用<tt><tt></tt> 和将 > 和< 更改为<tt>&gt;</tt>和 <tt>&lt;</tt>,并且在代码例子内使用行分隔符<tt><br /></tt>,使得文本看起来像代码。这种样式的好处在于使用空格的时候,代码会自动地包裹,能够显示更长的代码。 <div style="padding: 1em; border: 1px dashed #2f6fab; color: Black; background-color: #f9f9f9; line-height: 1.1em"><tt><div class="post" id="post-<?php the_ID(); ?>"><<br /> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2><br /> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small></tt></div> <div style="padding: 1em; border: 1px dashed #2f6fab; color: Black; background-color: #f9f9f9; line-height: 1.1em"><tt><div class="post" id="post-<?php the_ID(); ?>"><<br /> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2><br /> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small></tt></div> In which the code looks like this: 代码看起来像: <pre><div style="padding: 1em; border: 1px dashed #2f6fab; color: Black; background-color: #f9f9f9; line-height: 1.1em"> <tt> &lt;div class="post" id="post-&lt;?php the_ID(); ?&gt;"&gt;&lt;br /&gt; &lt;h2&gt;&lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark" title="Permanent Link to &lt;?php the_title(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;&lt;br /&gt; &lt;small&gt;&lt;?php the_time('F jS, Y') ?&gt; &lt;!-- by &lt;?php the_author() ?&gt; --&gt;&lt;/small&gt; </tt> </div></pre> <pre><div style="padding: 1em; border: 1px dashed #2f6fab; color: Black; background-color: #f9f9f9; line-height: 1.1em"> <tt> &lt;div class="post" id="post-&lt;?php the_ID(); ?&gt;"&gt;&lt;br /&gt; &lt;h2&gt;&lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark" title="Permanent Link to &lt;?php the_title(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;&lt;br /&gt; &lt;small&gt;&lt;?php the_time('F jS, Y') ?&gt; &lt;!-- by &lt;?php the_author() ?&gt; --&gt;&lt;/small&gt; </tt> </div></pre> For more information on using character entities or codes within a document, see [[WordPress:Writing Code in Your Posts]]. 关于在文档内使用代码实体或者代码的更多的信息,请看看[[WordPress:Writing Code in Your Posts|在你的文章中编写代码]]。
摘要:
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅
Wordpress-mediawiki:版权
的细节)。
未经许可,请勿提交受版权保护的作品!
取消
编辑帮助
(在新窗口中打开)