DUX主題會員中心美化集成 Erphpdown 插件

DUX 主題 2.0 版本之后新增了?erphpdown 登錄時使用dux彈出登錄框的功能,然而會員中心一直是老樣式,并未集成 Erphpdown 的前端功能。同時,雖然 Erphpdown 插件作者提供了一個前端會員中心的頁面(page-erphpdown-user.php),這個頁面比較粗糙,而且同一個網站使用兩個不同的用戶中心,對訪問者來說似乎也不太友好。于是自己決定將?DUX主題用戶中心與 Erphpdown 集成起來,方便博客用戶使用,下面是集成前后的前端樣式,我將相關功能合并到了不同的選項卡,避免前端臃腫。

DUX主題用戶中心集成 Erphpdown 插件

集成前

DUX主題用戶中心集成 Erphpdown 插件

集成后

前端顯示大概就是這個樣子,有喜歡的繼續看下面(當然,樣式的話自己調整也是可以的)。溫馨提示:主題修改前請做好備份!備份!!備份!!!

此次集成 Erphpdown 主要用了插件的短代碼功能,插件新增短代碼的相關的代碼在?includes 文件夾下的?shortcode.php 文件中,主要是以下內容:

add_shortcode( 'ice_purchased_goods','purchased_goods_lists');//已購商品

add_shortcode( 'ice_purchased_tuiguang','purchased_tuiguang_lists');//我的推廣

add_shortcode( 'ice_purchased_tuiguangxiazai','purchased_tuiguangxiazai_lists');//推廣下載

add_shortcode( 'ice_purchased_tuiguangvip','purchased_tuiguangvip_lists');//推廣vip

add_shortcode( 'ice_order_tracking','order_tracking_lists');//訂單查詢

add_shortcode( 'ice_my_property', 'my_property' );//我的資產

add_shortcode( 'ice_recharge_money','recharge_money');//充值

add_shortcode( 'ice_cash_application','cash_application');//取現申請

add_shortcode( 'ice_cash_application_lists','cash_application_lists');//取現列表

add_shortcode( 'vip_tracking_lists','vip_tracking_lists');//VIP訂單查詢

add_shortcode( 'ice_vip_member_service','vip_member_service');//VIP會員服務

此次主題修改比較繁瑣,需要動幾個位置,這里以“我要推廣”為例,簡單說下配置的過程,同時文后會提供我此次修改的下載文件,大家自行下載即可!

user.php 文件修改

位于主題根目錄下的 pages/user.php 文件是 DUX 主題的會員中心頁面模板,我們只需要在該文件中大概 24 行代碼處插入如下代碼即可:

<li class="usermenu-tuiguang"><a href="#tuiguang">我要推廣</a></li>

插入完成并保存上傳后應該可以在會員中心顯示出對應的選項卡。然后繼續修改本文件,在 160行代碼處,最后一個 script 標簽結束位置插入如下代碼:

<script id="temp-tuiguang" type="text/x-jsrender">
    <?php echo purchased_tuiguang_lists(); ?>
    <?php echo purchased_tuiguangxiazai_lists(); ?>
    <?php echo purchased_tuiguangvip_lists(); ?>
</script>

注意這地方的?purchased_tuiguang_lists(); 可在文章開篇短代碼處找到,其他的修改與之類似。

user.js 文件修改

文件 js/user.js 主要是控制會員中心的一些動作的,在文件大概 204 行代碼處應該可以找到?‘post-new’: function() 這樣一句代碼。在該代碼之前插入如下一段代碼:

'tuiguang': function(){
    menuactive('tuiguang')
    _main.html(
        $('#temp-tuiguang').render()
    )				
},


如此我們即能對程序的運行有個簡單的了解。用戶點擊會員中心選項卡觸發上面這段 JS 代碼,代碼激活“我要推廣”菜單,并通過 render() 渲染生成上一步在 script 標簽中的頁面信息以顯示出來。做到這一步基本上前端可以獲取相關數據了,但是不太美觀,下面我們對其進行簡單美化。

user.css 文件修改

控制 DUX 主題會員中心顯示樣式的代碼在 css/user.css 文件中,由于插件會不斷更新,主題也會不斷更新,為了避免日后調整修改較大,這里盡量沒有修改插件下相關核心文件的樣式類。當然,這也不可避免地造成了樣式代碼的臃腫。“魚與熊掌不可兼得”,如果你希望能更精簡代碼,可自行調整代碼以進一步優化。這里僅給出我完全修改完后 PC 端顯示樣式的代碼(懶,不想再調整移動端的樣式了)。代碼如下:

/** DUX 主題用戶中心集成 Erphpdown */
.user-main-property>.wrap{
    margin:20px 10px 5px;
    padding:5px;
}

.user-main-property>.wrap h2{
    margin: 10px;
    padding: 5px;
    font-size: 20px;
    line-height: 20px;
    border-left: 5px solid #239fef;
}

/** 表單 form-table */
.user-main-property>.wrap .form-table{
    width: 100%;
    margin: 20px;
    border-collapse: collapse;
}
.user-main-property>.wrap .form-table tr{
    font-size: 16px;
    margin: 10px;
    line-height: 36px;
}
.user-main-property>.wrap .form-table td{
    padding: 0 30px;
}
.user-main-property>.wrap .form-table td input{
    padding: 0 10px;
    line-height: 24px;
    font-size: 12px;
    text-align: right;
    border: 1px solid #239fef;
    border-radius: 5px;
}
.user-main-property>.wrap .form-table td input[type=radio]{
    display: inline-block;
    vertical-align: text-top;
    font-size: 18px;
    width: 1em;
    height: 1em;
    margin-right: .5em;
    line-height: 1; 
}
.user-main-property>.wrap .form-table td input[type=submit] {
    margin: 20px 0 0;
    padding: 5px 30px;
    color: #fff;
    font-size: 18px;
    text-align: center;
    line-height: 20px;
    background: #239fef;
    border: 1px solid #239fef;
    border-radius: 9px;
}
.user-main-property>.wrap .form-table td input[type=submit]:hover {
    opacity: 0.8;
}

/** 表單 widefat */
.user-main-property>.wrap>.widefat{
    border-collapse: collapse;
    width: 100%;
    border: 1px solid #239fef;
    margin: 20px 10px 0px;
}
.user-main-property>.wrap>.widefat th{
    border-collapse: collapse;
    border-right:1px solid #fff;
    border-bottom:1px solid #239fef;
    background-color:#239fef; 
    padding:5px 9px;
    color: #fff;
    font-size: 14px;
    line-height:24px;
    font-weight: normal;
    text-align: center;
    white-space: nowrap;
    word-break: break-all;
}

.user-main-property>.wrap>.widefat th:last-child{
    border-right:1px solid #239fef;
}
.user-main-property>.wrap>.widefat td{
    border-collapse: collapse;
    border-right:1px solid #239fef;
    border-bottom:1px solid #239fef; 
    padding:5px 9px;
    font-size:12px;
    line-height:20px;
    font-weight:normal;
    text-align:left;
    overflow:hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
}
.user-main-property>.wrap>.widefat tr:nth-child(odd){
    background-color: #fff; 
}
.user-main-property>.wrap>.widefat tr:nth-child(even){
    background-color: #f8f8f8;
}

.user-main{
    position: relative;
    min-height: 600px;
    padding: 20px 0px;
}
.user-main>font{
    margin: 20px;
    padding: 5px;
    font-size: 20px;
    font-weight: 700;
}

.user-main>.wrap{
    margin:20px;
    padding:5px;
}

.user-main>.wrap h2{
    margin: 10px;
    padding: 5px;
    font-size: 20px;
    line-height: 20px;
    border-left: 5px solid #239fef;
}

.user-main>.wrap>p{
    margin: 3px;
    padding: 5px;
}
.user-main>.wrap p:first-child{
    margin: 3px;
    padding: 5px;
    color: red;
    font-size: 16px;
}

.user-main>.wrap>p>textarea{
    display: block;
    margin: 20px 10px;
    padding: 5px;
    width: 100%;
    border: 1px solid #239fef;
    border-radius: 5px;
    overflow: hidden;
}

/** 表單 form-table */
.user-main>.wrap .form-table{
    width: 100%;
    margin: 20px 10px 0;
    border-collapse: collapse;
}
.user-main>.wrap .form-table tr{
    font-size: 16px;
    margin: 10px;
    line-height: 36px;
}
.user-main>.wrap .form-table td{
    padding: 0 30px;
}
.user-main>.wrap .form-table td input{
    padding: 0 10px;
    line-height: 24px;
    font-size: 12px;
    text-align: right;
    border: 1px solid #239fef;
    border-radius: 5px;
}
.user-main>.wrap .form-table td input[type=radio]{
    display: inline-block;
    vertical-align: text-top;
    font-size: 18px;
    width: 1em;
    height: 1em;
    margin-right: .5em;
    line-height: 1; 
}
.user-main>.wrap form p{
    margin: 10px;	
}
.user-main>.wrap form input[type=submit] {
    padding: 5px 30px;
    color: #fff;
    font-size: 18px;
    text-align: center;
    line-height: 20px;
    background: #239fef;
    border: 1px solid #239fef;
    border-radius: 9px;
}
.user-main>.wrap form input[type=submit]:hover {
    opacity: 0.8;
}

/** 表單 widefat */
.user-main>.wrap>.widefat{
    border-collapse: collapse;
    width: 100%;
    border: 1px solid #239fef;
    margin: 20px 10px 0px;
}
.user-main>.wrap>.widefat th{
    border-collapse: collapse;
    border-right:1px solid #fff;
    border-bottom:1px solid #239fef;
    background-color:#239fef; 
    padding:5px 9px;
    color: #fff;
    font-size: 14px;
    line-height:24px;
    font-weight: normal;
    text-align: center;
    white-space: nowrap;
    word-break: break-all;
}

.user-main>.wrap>.widefat th:last-child{
    border-right:1px solid #239fef;
}
.user-main>.wrap>.widefat td{
    border-collapse: collapse;
    border-right:1px solid #239fef;
    border-bottom:1px solid #239fef; 
    padding:5px 9px;
    font-size:12px;
    line-height:20px;
    font-weight:normal;
    text-align:left;
    overflow:hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
}
.user-main>.wrap>.widefat tr:nth-child(odd){
    background-color: #fff; 
}
.user-main>.wrap>.widefat tr:nth-child(even){
    background-color: #f8f8f8;
}

方法大概就是這樣了。不想折騰的直接下載文后的文件替換即可。如果還有什么其他問題,請在文章下方反饋。

贊(0)
版權聲明:本文采用知識共享 署名4.0國際許可協議 [BY-NC-SA] 進行授權, 轉載請注明出處。
文章名稱:《DUX主題會員中心美化集成 Erphpdown 插件》
文章鏈接:http://www.lrracing.com/6095.html
【聲明】:國外主機測評僅分享信息,不參與任何交易,也非中介,所有內容僅代表個人觀點,均不作直接、間接、法定、約定的保證,讀者購買風險自擔。一旦您訪問國外主機測評,即表示您已經知曉并接受了此聲明通告。
【關于安全】:任何 IDC商家都有倒閉和跑路的可能,備份永遠是最佳選擇,服務器也是機器,不勤備份是對自己極不負責的表現,請保持良好的備份習慣。