boxmoe_header_banner_img

CraftWyrd

文章导读

wordpress调整记录


avatar
CraftWyrd 2026年1月7日 85
<h3>1、时区问题</h3>
<p>当前主题lolimeow中,/wp-content/themes/lolimeow-master/functions.php
<img src="https://blog.drivod.top/wp-content/uploads/2026/01/image-1767774846694.png" alt="file" />
需要注释时区设置,否则会有奇怪冲突似乎</p>
<h3>2、主题调整</h3>
<h4>视频src调整</h4>
<p>/wp-content/themes/lolimeow-master/core/module/fun-shortcode.php:
227行,原有代码读取标签和插入不一致导致视频src无法正确填充
调整后代码</p>
<pre><code>add_shortcode(&#039;video&#039;, &#039;video_shortcode&#039;);  
function video_shortcode( $attr , $content = &#039; &#039;) {
    // 合并默认参数和用户传入的参数,重点读取mp4参数
    $atts = shortcode_atts( array(
        &#039;mp4&#039; =&gt; &#039;&#039;,     // 对应你短代码里的mp4参数
        &#039;width&#039; =&gt; &#039;1280&#039;,  // 默认宽度
        &#039;height&#039; =&gt; &#039;720&#039;   // 默认高度
    ), $attr );

    // 检查mp4链接是否存在,避免空链接
    if (empty($atts[&#039;mp4&#039;])) {
        return &#039;&lt;p&gt;视频链接不能为空&lt;/p&gt;&#039;;
    }

    // 拼接视频HTML,使用正确的mp4参数,宽高也使用短代码里的值
    $out = &#039;&lt;video preload=&quot;none&quot; controls=&quot;controls&quot; width=&quot;&#039;.esc_attr($atts[&#039;width&#039;]).&#039;&quot; height=&quot;&#039;.esc_attr($atts[&#039;height&#039;]).&#039;&quot;&gt;
                &lt;source type=&quot;video/mp4&quot; src=&quot;&#039;.esc_attr($atts[&#039;mp4&#039;]).&#039;&quot;&gt;
            &lt;/video&gt;&#039;;
    return $out;
}</code></pre>
<h4>css样式调整</h4>
<p>不多赘述,f12查看对应元素css,在源代码里搜索既可
核心调整背景颜色,字体大小等
关键字</p>
<pre><code>.post-single pre.prettyprint ol.linenums li
.single-content code</code></pre>
<h4>转义异常处理</h4>
<p>使用了插件wd githuber md,仍未找到完美的转义修复方案,因为在后管编辑中转义和解析后都不一致
主题的functions.php中添加
这里不贴代码块是因为这段代码无法被完美转义与解析
<a href="https://blog.drivod.top/wp-content/uploads/2026/01/WordPress转义修复.txt" title="WordPress转义修复">WordPress转义修复</a></p>

1、时区问题

当前主题lolimeow中,/wp-content/themes/lolimeow-master/functions.php
file
需要注释时区设置,否则会有奇怪冲突似乎

2、主题调整

视频src调整

/wp-content/themes/lolimeow-master/core/module/fun-shortcode.php:
227行,原有代码读取标签和插入不一致导致视频src无法正确填充
调整后代码

add_shortcode('video', 'video_shortcode');  
function video_shortcode( $attr , $content = ' ') {
    // 合并默认参数和用户传入的参数,重点读取mp4参数
    $atts = shortcode_atts( array(
        'mp4' => '',     // 对应你短代码里的mp4参数
        'width' => '1280',  // 默认宽度
        'height' => '720'   // 默认高度
    ), $attr );

    // 检查mp4链接是否存在,避免空链接
    if (empty($atts['mp4'])) {
        return '<p>视频链接不能为空</p>';
    }

    // 拼接视频HTML,使用正确的mp4参数,宽高也使用短代码里的值
    $out = '<video preload="none" controls="controls" width="'.esc_attr($atts['width']).'" height="'.esc_attr($atts['height']).'">
                <source type="video/mp4" src="'.esc_attr($atts['mp4']).'">
            </video>';
    return $out;
}

css样式调整

不多赘述,f12查看对应元素css,在源代码里搜索既可
核心调整背景颜色,字体大小等
关键字

.post-single pre.prettyprint ol.linenums li
.single-content code

转义异常处理

使用了插件wd githuber md,仍未找到完美的转义修复方案,因为在后管编辑中转义和解析后都不一致
主题的functions.php中添加
这里不贴代码块是因为这段代码无法被完美转义与解析
WordPress转义修复



评论(0)

查看评论列表

暂无评论


发表评论