我有用于 Wordpress 的“WP-client”插件,它允许每个用户拥有自己的个人“HUB 页面”,他们在登录时被重定向到。每个用户都有一个带有“wpc_portal_alert”的自定义字段,当我在页面上放置短代码“{wpc_portal_alert}”时,它会在 CSS 错误消息框中显示自定义字段的内容。我遇到的问题是,当我将字段留空时,创建的图片和红色字段仍然存在(如下图)。我需要以某种方式检查该字段是否有文本,如果没有,则不显示 . 我在想这需要 javascript,我非常有能力,但我可能需要访问数据库来获取自定义字段的内容。我对MySQL、数据库不太熟悉,
HTML:
<link href="http://troop18caz.com/error-style.css" rel="stylesheet" type="text/css" />
<p style="text-align: center;"><span style="font-size: 25px; color: #800000;">Welcome to your Private and Secure Client Portal <span style="font-size: 25px;">| [wpc_client_logoutb]</span></span></p>
<div class="errormsgbox">
{wpc_portal_alert}
</div>
<table style="width: 100%;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td style="width: 50%;" valign="top"><img title="" alt="" src="[wpc_client_theme][/wpc_client_theme]/your_pages.png" /></td>
<td style="width: 50%;" valign="top"><img title="" alt="" src="[wpc_client_theme][/wpc_client_theme]/upload_files.png" /></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td style="width: 50%;" valign="top">[shortmenu menu="Menu" enhance="flase" ]</td>
<td style="width: 50%;" valign="top">Drag files to the box below, or click "Select Files" below.[wpc_client_uploadf][/wpc_client_uploadf]</td>
</tr>
<tr>
<td style="width: 50%;" valign="top"></td>
<td style="width: 50%;" valign="top"></td>
</tr>
<tr>
<td style="width: 50%;" valign="top"><img title="" alt="" src="[wpc_client_theme][/wpc_client_theme]/uploaded_files.png" /></td>
<td style="width: 50%;" valign="top"><img title="" alt="" src="[wpc_client_theme][/wpc_client_theme]/your_files.png" /></td>
</tr>
<tr>
<td style="width: 50%;" valign="top">[wpc_client_fileslu][/wpc_client_fileslu]</td>
<td style="width: 50%;" valign="top">[wpc_client_filesla][/wpc_client_filesla]</td>
</tr>
<tr>
<td style="width: 50%; height: 70px;" valign="top"></td>
<td style="width: 50%;" valign="top"></td>
</tr>
<tr>
<td colspan="2" valign="top"><img title="" alt="" src="[wpc_client_theme][/wpc_client_theme]/messages.png" /></td>
</tr>
<tr>
<td colspan="2" valign="top">[wpc_client_com][/wpc_client_com]</td>
</tr>
</tbody>
</table>
CSS:
.successbox, .warningbox, .errormsgbox {
font-weight:bold;
border: 2px solid;
margin: 10px 0px;
padding:10px 10px 10px 70px;
background-repeat: no-repeat;
background-position: 10px center;
width:90%;
}
.successbox {
color: #4F8A10;
background-color:#EDFCED;
background-image:url('images/success.png');
}
.warningbox {
color: #FFE222;
background-color:#FAF9C9;
background-image: url('images/warning.png');
}
.errormsgbox {
color: #D8000C;
background-color:#FDD5CE;
background-image: url('http://troop18caz.com/wp-content/uploads/2013/08/error.png');
}