主题森林里的the7主题已经升级到6.3.了,网上下载的主题已经不能在线导入演示,并且时时提示未注册,好多功能不能用了。如果正规用途建议官网购买,安全,更新都有保证。

目前是最新版本v.6.3.1 (Mar 30, 2018),官方链接https://themeforest.net/item/the7-responsive-multipurpose-wordpress-theme/5556590
官方演示主页:http://the7.io/


主题为原版源码,是需要授权码进行授权的,安装主题之后,后台会提示未注册,不注册并不会影响使用,只影响到在线升级和演式内容的导入,若想把未注册变为注册,请接着往下看。
修改主题里面的dt-the7\inc\mods\demo-content\includes\class-the7-demo-content-remote-server-api.php文件,具体修改如下:
第8行添加以下代码:
update_site_option( ‘the7_registered’, ‘yes’ );
update_site_option( ‘the7_purchase_code’, ‘the7_purchase_code’ );
如下:
|
01
02
03
04
05
06
07
08
09
10
11
12
|
<?php/** * DT Dummy remote API. Used to communicate with DT dummy server. * * @since 2.0.0 * @package dt-dummy/includes */ update_site_option( 'the7_registered', 'yes' );update_site_option( 'the7_purchase_code', 'the7_purchase_code' ); class The7_demo_Content_Remote_Server_API { |
修改后保存,安装主题后,主题将显示为已注册,如下图:

若想要导放官方的演式内容,接着往下修改:
删除95行至110行的内容,红色为要删除的代码
$request_url = add_query_arg( array( ‘item’ => $id, ‘code’ => $code ), $this->api_remote_download_url );
$remote_response = wp_safe_remote_get( $request_url, array(
‘timeout’ => 300,
‘user-agent’ => ‘WordPress/’ . get_bloginfo( ‘version’ ) . ‘; ‘ . network_site_url(),
) );
if ( is_wp_error( $remote_response ) ) {
return $remote_response;
}
$response_code = wp_remote_retrieve_response_code( $remote_response );
if ( ! is_array( $remote_response ) || 200 != $response_code ) {
return new WP_Error( ‘download_failed’, $this->strings[‘download_failed’] );
}
删除114行的内容,红色为要删除的代码
$file_content = wp_remote_retrieve_body( $remote_response );
删除116行的内容,红色为要删除的代码
$wp_filesystem->put_contents( $zip_file_name, $file_content );
以下为原文件部份内容
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
public function download_dummy( $id, $code, $target_dir ) { /** * @var $wp_filesystem WP_Filesystem_Base */ global $wp_filesystem; if ( ! $wp_filesystem && ! WP_Filesystem() ) { return new WP_Error( 'fs_unavailable', $this->strings['fs_unavailable'] ); } if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() ) { return new WP_Error( 'fs_error', $this->strings['fs_error'], $wp_filesystem->errors ); } $request_url = add_query_arg( array( 'item' => $id, 'code' => $code ), $this->api_remote_download_url ); $remote_response = wp_safe_remote_get( $request_url, array( 'timeout' => 300, 'user-agent' => 'WordPress/' . get_bloginfo( 'version' ) . '; ' . network_site_url(), ) ); if ( is_wp_error( $remote_response ) ) { return $remote_response; } $response_code = wp_remote_retrieve_response_code( $remote_response ); if ( ! is_array( $remote_response ) || 200 != $response_code ) { return new WP_Error( 'download_failed', $this->strings['download_failed'] ); } wp_mkdir_p( $target_dir ); $file_content = wp_remote_retrieve_body( $remote_response ); $zip_file_name = trailingslashit( $target_dir ) . "{$id}.zip"; $wp_filesystem->put_contents( $zip_file_name, $file_content ); $unzip_result = unzip_file( $zip_file_name, $target_dir ); if ( is_wp_error( $unzip_result ) ) { return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], $unzip_result ); } $dummy_dir = trailingslashit( $target_dir ) . $id; if ( ! is_dir( $dummy_dir ) ) { return new WP_Error( 'fs_no_folder', sprintf( $this->strings['fs_no_folder'], $dummy_dir ) ); } return $dummy_dir;} |
修改后保存,安装主题后,主题将显示为已注册,上传the7-demo-content-tmp(文件在下方下载)文件夹到Wordpress的wp-content/uploads/ 目录下,然后转到仪表盘的 The7 – Pre-made Websites,开始导入你想要的演示吧,如下图:

the7-demo-content-tmp演示数据下载地址:
链接:http://pan.baidu.com/s/1c1FZrJM 密码:x0ss
插件下载地址:
链接:http://pan.baidu.com/s/1c1A9Ge0 密码:iabw
