var i = 0, got = -1, len = document.getElementsByTagName('script').length; while ( i <= len && got == -1){ var js_url = document.getElementsByTagName('script')[i].src, got = js_url.indexOf('comments-ajax.js'); i++ ; }
WP Super Cache:这个插件,在搬家后,需要重新安装WP Super Cache 。 登入FTP空间删除文件wp-content/wp-cache-config.php和wp-content/advanced-cache.php 编辑文件wp-config.php,删除以下两行开头的代码: define(‘WP_CACHE’,true); define(‘WPCACHEHOME’,’ 然后重新安装WP Super Cache即可。
更换域名问题
需要修改数据库中,wp_options表中的home和siteurl两个字短的值为当前域名地址。
排版错乱问题
首先,我们需要检查一下网站的PHP版本设置是否正确,WordPress的话,一般是使用5.3或者5.4的PHP版本,如果是5.2的话,是有可能导致网站排版混乱的问题。以许滋博客使用的阿里云为例,登录到控制面板,在select php version 处修改为5.3版本即可。
网站主页可访问,其他页面提示404错误
也可能提示为 The requested URL was not found on this server 登录主机空间控制面板,在文件管理处开启查看隐藏文件,查看.htaccess是否有正确的内容。一般初始化的.htaccess文件内容为:
1 2 3 4 5 6 7 8 9
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /WP/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /WP/index.php [L] </IfModule># END WordPress
昨天虚机上传网页,打开测试页面的时候出现如下错误: Forbidden. You don’t have permission to access /index.html on this server. 开始我以为我网页出错,后来发现是权限问题,立马搞定了. 原因:index.html是用root用户建的文件,虚机上权限限制且无法修改,只能修改网页访问权限。 解决方法: 更改文件权限:chmod 755 index.html 或者在ftp软件中设置该文件权限
配置修改
如果是WinServer下出现这个问题,请打开apache下配置文件httpd.conf,找到:
1 2 3 4 5 6
<Directory /> Options FollowSymLinks AllowOverride None Order deny,allow deny from all </Directory>
然后试着把deny from all中的deny改成了allow,保存后重起apache,测试网站就可以访问了。
A First Level Header ==================== A Second Level Header ---------------------
Now is the time for all good men to come to the aid of their country. This is just a regular paragraph.
The quick brown fox jumped over the lazy dog's back. ### Header 3
> This is a blockquote. > > This is the second paragraph in the blockquote. > > ## This is an H2 in a blockquote
输出 HTML 为:
1 2 3 4 5 6 7 8 9 10 11 12 13
<h1>A First Level Header</h1> <h2>A Second Level Header</h2> <p>Now is the time for all good men to come to the aid of their country. This is just a regular paragraph.</p> <p>The quick brown fox jumped over the lazy dog's back.</p> <h3>Header 3</h3> <blockquote> <p>This is a blockquote.</p> <p>This is the second paragraph in the blockquote.</p> <h2>This is an H2 in a blockquote</h2> </blockquote>
修辞和强调
Markdown 使用星号和底线来标记需要强调的区段。 Markdown 语法:
1 2 3 4
Some of these words *are emphasized*. Some of these words _are emphasized also_. Use two asterisks for **strong emphasis**. Or, if you prefer, __use two underscores instead__.
输出 HTML 为:
1 2 3 4
<p>Some of these words <em>are emphasized</em>. Some of these words <em>are emphasized also</em>.</p> <p>Use two asterisks for <strong>strong emphasis</strong>. Or, if you prefer, <strong>use two underscores instead</strong>.</p>
<p>I get 10 times more traffic from <a href="http://google.com/" title="Google">Google</a> than from <a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
title 属性是选择性的,链接名称可以用字母、数字和空格,但是不分大小写:
1 2 3 4
I start my morning with a cup of coffee and [The New York Times][NY Times].
[ny times]: http://www.nytimes.com/
输出 HTML 为:
1 2
<p>I start my morning with a cup of coffee and <a href="http://www.nytimes.com/">The New York Times</a>.</p>
在一般的段落文字中,你可以使用反引号 ` 来标记代码区段,区段内的 &、< 和 > 都会被自动的转换成 HTML 实体,这项特性让你可以很容易的在代码区段内插入 HTML 码:
1 2 3 4
I strongly recommend against using any `<blink>` tags.
I wish SmartyPants used named entities like `—` instead of decimal-encoded entites like `—`.
输出 HTML 为:
1 2 3 4 5
<p>I strongly recommend against using any <code><blink></code> tags.</p> <p>I wish SmartyPants used named entities like <code>&mdash;</code> instead of decimal-encoded entites like <code>&#8212;</code>.</p>
If you want your page to validate under XHTML 1.0 Strict, you've got to put paragraph tags in your blockquotes:
<blockquote> <p>For example.</p> </blockquote>
输出 HTML 为:
1 2 3 4 5 6
<p>If you want your page to validate under XHTML 1.0 Strict, you've got to put paragraph tags in your blockquotes:</p> <pre><code><blockquote> <p>For example.</p> </blockquote> </code></pre>
Markdown 语法的目标是:成为一种适用于网络的_书写_语言。 Markdown 并不是想取代 HTML的地位,甚至接近它。它的语法种类很少,只对应 HTML 标记的一小部分。Markdown 的构想_不是_要使得 HTML 文档更容易书写。在我看来, HTML 已经很容易写了。Markdown 的理念是,能让文档更容易读、写和随意改。HTML 是一种_发布_的格式,Markdown 是一种_书写_的格式。就这样,Markdown 的格式语法只涵盖纯文本可以涵盖的范围。 不在 Markdown 涵盖范围之内的标签,都可以直接在文档里面用 HTML 撰写。不需要额外标注这是 HTML 或是 Markdown;只要直接加标签就可以了。 要制约的只有一些 HTML 区块元素――比如 <div>、<table>、<pre>、<p> 等标签,必须在前后加上空行与其它内容区隔开,还要求它们的开始标签与结尾标签不能用制表符或空格来缩进。Markdown 的生成器有足够智能,不会在 HTML 区块标签外加上不必要的 <p> 标签。 例子如下,在 Markdown 文件里加上一段 HTML 表格:
1 2 3 4 5 6 7 8 9
这是一个普通段落。
<table> <tr> <td>Foo</td> </tr> </table>
这是另一个普通段落。
请注意,在 HTML 区块标签间的 Markdown 格式语法将不会被处理。比如,你在 HTML 区块内使用 Markdown 样式的*强调*会没有效果。 HTML 的区段(行内)标签如 <span>、<cite>、<del> 可以在 Markdown 的段落、列表或是标题里随意使用。依照个人习惯,甚至可以不用 Markdown 格式,而直接采用 HTML 标签来格式化。举例说明:如果比较喜欢 HTML 的 <a> 或 <img> 标签,可以直接使用这些标签,而不用 Markdown 提供的链接或是图像标签语法。 和处在 HTML 区块标签间不同,Markdown 语法在 HTML 区段标签间是有效的。
特殊字符自动转换
在 HTML 文件中,有两个字符需要特殊处理: < 和 & 。 < 符号用于起始标签,& 符号则用于标记 HTML 实体,如果你只是想要显示这些字符的原型,你必须要使用实体的形式,像是 < 和 &。 & 字符尤其让网络文档编写者受折磨,如果你要打「AT&T」 ,你必须要写成「AT&T」。而网址中的 & 字符也要转换。比如你要链接到:
类似的状况也会发生在 < 符号上,因为 Markdown 允许 兼容 HTML ,如果你是把 < 符号作为 HTML 标签的定界符使用,那 Markdown 也不会对它做任何转换,但是如果你写:
1
4 < 5
Markdown 将会把它转换为:
1
4 < 5
不过需要注意的是,code 范围内,不论是行内还是区块, < 和 & 两个符号都_一定_会被转换成 HTML 实体,这项特性让你可以很容易地用 Markdown 写 HTML code (和 HTML 相对而言, HTML 语法中,你要把所有的 < 和 & 都转换为 HTML 实体,才能在 HTML 文件里面写出 HTML code。)
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. > > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse > id sem consectetuer libero luctus adipiscing.
Markdown 也允许你偷懒只在整个段落的第一行最前面加上 > :
1 2 3 4 5 6
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
区块引用可以嵌套(例如:引用内的引用),只要根据层次加上不同数量的 > :
1 2 3 4 5
> This is the first level of quoting. > > > This is nested blockquote. > > Back to the first level.
* Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
但是如果你懒,那也行:
1 2 3 4 5
* Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
如果列表项目间用空行分开,在输出 HTML 时 Markdown 就会将项目内容用 <p> 标签包起来,举例来说:
1. This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
2. Suspendisse id sem consectetuer libero luctus adipiscing.
如果你每行都有缩进,看起来会看好很多,当然,再次地,如果你很懒惰,Markdown 也允许:
1 2 3 4 5 6 7
* This is a list item with two paragraphs.
This is the second paragraph in the list item. You're only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
<p>I get 10 times more traffic from <a href="http://google.com/" title="Google">Google</a> than from <a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
下面是用行内式写的同样一段内容的 Markdown 文件,提供作为比较之用:
1 2 3
I get 10 times more traffic from [Google](http://google.com/ "Google") than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or [MSN](http://search.msn.com/ "MSN Search").
参考式的链接其实重点不在于它比较好写,而是它比较好读,比较一下上面的范例,使用参考式的文章本身只有 81 个字符,但是用行内形式的却会增加到 176 个字元,如果是用纯 HTML 格式来写,会有 234 个字元,在 HTML 格式中,标签比文本还要多。 使用 Markdown 的参考式链接,可以让文件更像是浏览器最后产生的结果,让你可以把一些标记相关的元数据移到段落文字之外,你就可以增加链接而不让文章的阅读感觉被打断。