去除 The7 主題導入演示數據限制和改為已註冊方法

正在查看 2 個帖子:1-2 (共 2 個帖子)
  • 作者
    帖子
  • 詩語
    管理員
    • 文章數量: 5,943
    發帖數:10000
    樓主
    @feibisi

    The7 主題為原版源碼,是需要授權碼進行授權的,安裝主題之後,後台會提示未註冊,不註冊並不會影響使用,隻影響到在線升級和演式內容的導入,若想把未註冊變為註冊,請接着往下看。

    修改主題裏面的 dt-the7/incmods/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』 );

    如下:

    
    <?php
    /**
    * DTDummy remote API. Used to communicate with DTdummy 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 {
    詩語
    管理員
    • 文章數量: 5,943
    發帖數:10000
    樓主
    @feibisi

    目前是最新版本 v.5.6.0.1 (Oct 13, 2017),

    修改後保存,安裝主題後,主題將顯示為已註冊,如下圖:

    若想要導放官方的演式內容,接着往下修改:

    刪除 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 );

正在查看 2 個帖子:1-2 (共 2 個帖子)
  • 哎呀,回覆話題必需登錄。

話題信息