刘切切 發表於 2023-9-8 00:00:00

wordpress 如何从后台数据库修改theme(图文教程)

<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
我们在wordpress主题theme配置的时候,会从网站上下载比较流行的theme,使自己的blog看着很酷。也有不顺利的时候,你下载的theme有bug或者下载包出问题了,安装过后你的web页面不能在访问了。悲催,想通过web将theme改回去也不行。我们只能够通过后台数据库来手动修改theme了。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
<strong>方法如下</strong>:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
打开phpMyAdmin,选择对应的数据库,在sql文本框中输入一下查询语句,我们就能得到当前的theme<br>
 </p>
<div style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<div style="margin: 0px; padding: 0px; outline: none; float: right; line-height: 25.2px; font-size: 14px;">
<span style="line-height: 25.2px; cursor: pointer;"><u>复制代码</u></span>
</div>
代码如下:</div>
<div id="phpcode8" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
SELECT * <br>
FROM wp_options <br>
WHERE option_name = 'template' <br>
OR option_name = 'stylesheet' <br>
OR option_name = 'current_theme'; </div>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
 </p>
<img title="wordpress 如何从后台数据库修改theme(图文教程)" alt="wordpress 如何从后台数据库修改theme(图文教程)" src="https://zhuji.jb51.net/uploads/img/202305/8cefa8a8ec43e571989afca5f381936c.jpg" style="max-width:100%!important;height:auto!important;border: 1px solid rgb(204, 204, 204); vertical-align: middle; padding: 1px; overflow: hidden; max-width: 696px; font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px; width: 766px; height: 327px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>结果如下:</span>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
<img title="wordpress 如何从后台数据库修改theme(图文教程)" alt="wordpress 如何从后台数据库修改theme(图文教程)" src="https://zhuji.jb51.net/uploads/img/202305/374e3a96e7a1332483a8b0adacae8692.jpg" style="max-width:100%!important;height:auto!important;border: 1px solid rgb(204, 204, 204); vertical-align: middle; padding: 1px; overflow: hidden; max-width: 696px; width: 522px; height: 418px;"></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
我们可以将对应的字段修改为我们的theme,系统自带的有 ‘classic’ 和‘default’.你可以选择其一,这里有两种方法,</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
第一,我们可以点击左侧编辑符号进行手动修改,</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
第二,我们可以执行一下sql语句:<br>
 </p>
<div style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<div style="margin: 0px; padding: 0px; outline: none; float: right; line-height: 25.2px; font-size: 14px;">
<span style="line-height: 25.2px; cursor: pointer;"><u>复制代码</u></span>
</div>
代码如下:</div>
<div id="phpcode9" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
UPDATE wp_options SET option_value = 'default' WHERE option_name = 'template'; <br><br>
UPDATE wp_options SET option_value = 'default' WHERE option_name = 'stylesheet'; <br><br>
UPDATE wp_options SET option_value = 'default' WHERE option_name = 'current_theme'; </div>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>注意,你可能在优化的时候将系统自带的theme删除了,所以我们设置的新theme需要和wp的theme下文件名称一致,如图: </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><img title="wordpress 如何从后台数据库修改theme(图文教程)" alt="wordpress 如何从后台数据库修改theme(图文教程)" src="https://zhuji.jb51.net/uploads/img/202305/537d938d613c067b516d4b715d928beb.jpg" style="max-width:100%!important;height:auto!important;border: 1px solid rgb(204, 204, 204); vertical-align: middle; padding: 1px; overflow: hidden; max-width: 696px; font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px; width: 400px; height: 224px;'>
頁: [1]
查看完整版本: wordpress 如何从后台数据库修改theme(图文教程)