作者归档:yee

Contact Form 7 不能显示访客网址post url

自从整站迁移后,wordpress的 contact form 7出现故障,表现为可正常接受客户输入的文字信息,但无法获取 post_url 和 post_title, 这两个标签分别是 访问网址 和 页面标题。小事不小,我为此失去两个客户询单,其实问题不大,主要难点在于排查故障,毕竟Wordpress现在是越来越臃肿庞大。初步怀疑是插件兼容性问题,之后是迁移后的环境变化问题,都无果。

最后终于找到了,原来的 contact form 7插件默认提示用的标签是[post_url] 和 [post_title]而且工作正常。但新版本改为 [_post_url]和[_post_title] ,没错就是前面多加一个“_”。注意,这些标签在 Contact Form DB 这个插件后台看还是只显示标签而非超链接和标题名,得在收到的邮件里面才会显示。

附官网的一些标签

TAG THIS TAG WILL BE REPLACED BY …
[_remote_ip] the sender’s client IP address.
[_user_agent] the sender’s user agent information.
[_url] the URL of the contact form.
[_date] the date of the submission.
[_time] the time of the submission.
[_post_id] the ID of the post which contains the contact form.
[_post_name] the name (slug) of the post which contains the contact form.
[_post_title] the title of the post which contains the contact form.
[_post_url] the permalink of the post which contains the contact form.
[_post_author] the author name of the post which contains the contact form.
[_post_author_email] the author email of the post which contains the contact form.
[_serial_number] a numeric string whose value increments. Requires Flamingo 1.5+ be installed.

小米蓝牙接收器夹子DIY解决方法

小米蓝牙接收器的夹子很容易断
淘宝上目前没有同款可以更换,于是我买了个普通的“耳机夹子”
不过因为尺寸不同无法直接套在小米接收器上,DIY解决方法如下图


用三条橡皮筋(或其他可以捆绑的东西)将普通的夹子绑在原来的夹子地方,结束!

额外评价下这个接收器,音质跟airpods是差很多的,主要作用就是跑步时听,反正外部噪音很多音质倒不那么重要了。

WordPress整站迁移到Hawkhost

我之前的5个网站全放在bluehost,最近转到hawkhost,折腾了一个周日才完成。下面说一下流程,方便后来者

  1. 进入Bluehost后台的Cpanel,file manager,把每个wordpress站的文件全部(compress)压缩成zip格式。下载推荐用网页(例如 http://网站/压缩文件名.zip),比ftp快很多。
  2. 进入Cpanel里面的phpmysql,把对应wordpress的数据库导出(export)成sql格式,备用。(下面基本没有bluehost的事了)
  3. 进入Hawkhost的Cpanel,mysql database, 创建新的数据库和用户名,并关联两者。再进入phpmysql,把第2步的sql导入(import)到新的数据库。
  4. Cpanel,添加域名(我选的是 addon domain,name sever换成hawkhost的,方便设置二级域名),同时会生成该域名对应的文件夹。
  5. Cpanel,file manager,将第1步下载回来的zip文件上传到域名对应目录并extarct(解压缩)。修改根目录下wp-config文件
    define('DB_NAME', 'AAA'); AAA为新站MySQL数据库名
    define('DB_USER', 'BBB'); BBB为新站的数据库用户名
    define('DB_PASSWORD', 'CCC'); CCC为新站数据库密码
    define('DB_HOST', 'DDD'); DDD为数据库主机名,这里填localhost
  6. 检查根目录上的.htaccess 有没有以前的奇怪路径,不懂的话直接删了吧
  7. 理论上,按照我这样操作,只要域名name server成功转移到hawkhost上,wordpress首页和后台就可以访问了。

下面是遇到的一些常见问题:

  1. 域名迁移到hawkhost后,所有域名显示空白页working,或者 显示”ERROR The requested URL could not be retrieved”。
    官网找不到技术支持,然后我意外找到解决方法- 出现这个情况应该是通过hawkhost后台的快捷键添加的addon domain,而且还设置了什么密码。解决方法:删掉这些之前的设置,重新在cpanel添加域名addon domain。一定要在cpanel操作,一定要在cpanel操作,一定要在cpanel操作。
  2. wordpress首页和后台正常,其他页面打不开。解决方法:进入wordpress后台,setting,permalink重新点击一次。
  3. 收不到忘记密码邮件、或收不到 contact form7 来信。我是用网易的域名邮箱,实测gmail却收的到,估计是网易对hawkhost上的wordpress邮件不友好吧。解决方法:进入phpmysql,对应的wordpress数据库的wp-option,里面有一行email改成其他邮箱。另外,把contact form7 里面的邮箱也换成其他邮箱(gmail)。
  4. SSL证书显示不安全。Hawkhost提供了免费的https加密,我有一个站却一直提示“不安全”。解决方法:Cpanel, SSL/TLS status, 选中那几个打红叉的问题网址,再点击Run AutoSSL。

折腾一天才搞懂这些,希望对其他人有帮助。

Blog’s moved to Hawkhost

Thanks to the Black Friday Promotion, I’ve move my blog from Bluehost to Hawkhost.

Our company website and this blog has been hosted at Bluehost for almost 3 years, if you want to ask why I move? Price will be an answer, other thing need to be considered is the access speed.

I live in China, occasionally travel around Asia and USA, from my past experience Bluehost is VERY SLOW in China, slow in Japan, normal in USA. I don’t have time to evaluate the speed of Hawkhost in other countries, but it’s acceptable in China, and that’s enough to me.

Oh, it appears Hawkhost gave this blog a free SSL certificate. It’s a paid service in bluehost!

Reconsidering about website

It’s said SSL certificates will be a MUST addon for B2B site, especially after 1 Jan 2017 when Google set those http sites as unsecured.

I did my homework about Bluehost where I host my websites.

The proceed was frustrating:
1. Thanks to China Telecom, it’s damn slow to login bluehost background. Connection failed many times during my operation, in fact I waste about 1.5 hours doing nothing!
2. To add SSL certificate, dedicated IP is necessary, which mean another USD5.99 per month (36 months).
3. They suggest me upgrade to a USD14.99 per month plan(36 months), which includes SSL and dedicated IP with better performance, but I’m satisfied with current performance.
4. I did a math again, finding it’s not a good bargain at all – My shared hosting plan charge USD4.99 per month only, and it will expire in 12 month. 14.99-4.99=10
5. So my best strategy will be, continue my existing plan, purchase dedicated IP and opt to a free SSL certificate. Let’s encrypt may be.

All previous posts deleted

2 or 3 months ago I deleted a suspicious mysql database from my web host, only few weeks later I realized really bad things happened – the database is my blog!

The websever has a backup of only 1 month, so I cannot recover the lost…

Here is the problem, what’s gone is gone, what’s next is what we don’t know.

If not this accident happened, I won’t be writing this post(I don’t update for months, maybe years).

The meaning of blog is very different from my teenage years, back to that time I would rather waste a whole afternoon to compose an article for strangers to read, for free. All I needed was self-satisfaction. When I grew up, life pushed me to forward, I am busy at work.