<samp id="0l9hf"></samp>
<td id="0l9hf"><option id="0l9hf"></option></td>

  • WP內容加密,文章實現部分內容可見或隱藏

    WordPress功能越來越強大,插件庫里幾乎能找到所有你想要的功能,例如,如果我們需要增加用戶粘性并改進交互功能,我們可以設置【WordPress文章部分內容可見或隱藏】【WordPress內容加密】,【WordPress用戶輸入密碼后可見】,【WordPress用戶評論后內容可見】,【WordPress用戶登陸后內容可見】等功能。

    這里先介紹WordPress部分內容可見或隱藏,輸入密碼后可見功能,你也可以查看相關文章【WordPress用戶評論后內容可見】,【用戶登陸后內容可見

    一,在主題functions.php文件中添加下面代碼

    function e_secret($atts, $content=null){
        extract(shortcode_atts(array('key'=>null), $atts));
        if(isset($_POST['e_secret_key']) && $_POST['e_secret_key']==$key){
            return '
    <div class="e-secret">'.$content.'</div>
    ';
        }
        else{
            return '
    <form class="e-secret" action="'.get_permalink().'" method="post" name="e-secret"><label>輸入密碼查看加密內容:</label><input type="password" name="e_secret_key" class="euc-y-i" maxlength="50"><input type="submit" class="euc-y-s" value="確定">
    <div class="euc-clear"></div>
    </form>
    ';
        }
    }
    add_shortcode('ssecret','e_secret');

    二,在主題style.css樣式文件里添加下面樣式代碼

    /*e-secret*/
    .e-secret {
        margin: 20px 0;
        padding: 20px;
        background: #f8f8f8;
    }
    .e-secret input.euc-y-i[type="password"] {
        float: left;
        background: #fff;
        width: 100%;
        line-height: 36px;
        margin-top: 5px;
        border-radius: 3px;
    }
    .e-secret input.euc-y-s[type="submit"] {
        float: right;
        margin-top: -47px;
        width: 30%;
        margin-right: 1px;
        border-radius: 0 3px 3px 0;
    }
    input.euc-y-s[type="submit"]{background-color:#3498db;color:#fff;font-size:21px;box-shadow:none;-webkit-transition: .4s;-moz-transition: .4s;-o-transition: .4s;transition:.4s;-webkit-backface-visibility:hidden;position:relative;cursor:pointer;padding: 13px 20px;text-align: center;border-radius: 50px;-webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none;border: 0;height: auto;outline: medium;line-height: 20px;margin: 0;}
    input.euc-y-s[type="submit"]:hover{background-color:#5dade2;}
    input.euc-y-i[type="text"],input.euc-y-i[type="password"]{border:1px solid #F2EFEF;color:#777;display:block;background: #FCFCFC;font-size:18px;transition:all .5s ease 0;outline:0;box-sizing:border-box;-webkit-border-radius:25px;-moz-border-radius:25px;border-radius:25px;padding:5px 16px; margin: 0;height: auto;line-height: 30px;}
    input.euc-y-i[type="text"]:hover,input.euc-y-i[type="password"]:hover{border:1px solid #56b4ef;box-shadow:0 0 4px #56b4ef;}

    三,加密文章內容如下

    [secret key="密碼"]
    加密內容
    [/secret]

    四,在頁面模板等頁面使用

    <?php 
        echo do_shortcode('[s e c r e t key="1256"]加密內容[/secret]'); 
    ?>

    五,測試功能,下面隱藏內容放了一份【福利】,你可以測試看看是否可行?!

    關注公眾號
    關注公眾號

    獲取密碼方式如下:

    關注我們公眾號,發送消息“查看密碼”,系統會自動給你查看密碼。

    相關文件推薦閱讀:
    WordPress內容加密,文章實現部分內容可見或隱藏,輸入密碼后可見
    WordPress內容加密,用戶評論后內容可見+分頁標簽
    WordPress插件發布,隱藏內容登陸后可見

    鄭重聲明:

    1 本資源來源于互聯網,資源的版權歸資源原作者所持有,受《中華人民共和國著作權法》等相關法律保護。

    2 由于無法和原作者取得聯系,所以上傳的部分資源無法先通過原作者的同意就分享給大家了,如本資源侵犯了您(原作者)的權益,請聯系我們(微信號 wenyan90s),我們會立馬刪除您的資源,并向您表達誠摯的歉意!

    3 本站是一個公益型網站,分享資源的目的在于傳播知識,分享知識,收取一點點打賞的辛苦費是用于網站的日常運營開支,并非用于商業用途。

    4 本站資源只提供學習和參考研究使用,使用過后請在第一時間內刪除。本站不承擔資源被單位或個人商用帶來的法律責任。

    1條評論

    發表評論

    国产精品午夜福利在线观看,av色片在线观看,男生看的黄色网站在线,黄片a片视频黄色
    <samp id="0l9hf"></samp>
    <td id="0l9hf"><option id="0l9hf"></option></td>