分类: 网站

  • 【网站】为WordPress添加APlayer播放器

    引入方式类似prism,由于使用概率较大,因此在主题模板函数中进行全局引入:

    // Function to add APlayer.mini.css and APlayer.mini.js to the site
    function add_APlayer() {
        
        wp_register_style(
            'APlayerCSS', // handle name for the style 
            get_stylesheet_directory_uri() . '/APlayer.css' // location of the file
        );
    
        wp_register_script(
            'APlayerJS', // handle name for the script 
            get_stylesheet_directory_uri() . '/APlayer.js' // location of the file
        );
    
        // Enqueue the registered style and script files
        wp_enqueue_style('APlayerCSS');
        wp_enqueue_script('APlayerJS');
    }
    add_action('wp_enqueue_scripts', 'add_APlayer');

    然后采用 APlayer官方文档 中描述的方式引入:

    <div id="aplayer">
    </div>
    <script>
    const ap = new APlayer({
        container: document.getElementById('aplayer'),
        audio: [{
            name: '',
            artist: '',
            url: '',
            cover: ''
        }]
    });
    </script>

  • 【网站美化】如何为WordPress添加Prism JS代码美化脚本?

    推荐使用Prism.js

    具体方法大神们早已经一笔一划的写出来了

    点击跳转!

    其中通过标签来非全局加载Js的方法非常棒!推荐参考学习。

    本网站则是全局加载JS,通过声明不同的CSS来实现美化效果。

    不加载Prism JS:

       <div class="container">
            <div class="diamond"></div> <!-- 第一个菱形 -->
            <div class="diamond"></div> <!-- 第二个菱形 -->
            <div class="diamond"></div> <!-- 第三个菱形 -->
            <div class="diamond"></div> <!-- 第四个菱形 -->
        </div>

    加载Prism JS:

       <div class="container">
            <div class="diamond"></div> <!-- 第一个菱形 -->
            <div class="diamond"></div> <!-- 第二个菱形 -->
            <div class="diamond"></div> <!-- 第三个菱形 -->
            <div class="diamond"></div> <!-- 第四个菱形 -->
        </div>

    很棒!

  • 【网站】关于WordPress上传限制大小的解决

    问题:

    WordPress预设一般为2M大小,非常不利于高清图片及音视频的上传,虽然对带宽有一定压力,但还是建议对上传大小进行修改。

    解决方法:

    网上一般都提到是对PHP与Nginx的ini文件进行调整,不过需要注意的是,在配置了SSL的网站中,Nginx只对根目录的ini文件进行调整无法起到效果,需要调整conf.d文件夹下的网站对应配置文件,才能起到效果。