Wordpress wp_编辑器不在表格单元格中?
我正在为WordPress制作一个自定义选项页面,并使用wp_编辑器。以下是我的代码:Wordpress wp_编辑器不在表格单元格中?,wordpress,html-table,wp-editor,Wordpress,Html Table,Wp Editor,我正在为WordPress制作一个自定义选项页面,并使用wp_编辑器。以下是我的代码: $settings = array('wpautop' => false, 'textarea_name' => $editor_id); echo '<table class="form-table">'; echo '<tbody>'; echo '<tr>'; echo '<th scope="col"
$settings = array('wpautop' => false, 'textarea_name' => $editor_id);
echo '<table class="form-table">';
echo '<tbody>';
echo '<tr>';
echo '<th scope="col">Enabled?</th>';
echo '<td><input name="emp_enabled" type="checkbox" value="checked" '.$get_settings['emp_enabled'].'><p class="description">Do you want to enable Maintenance Page?</p></td>';
echo '</tr>';
echo '<tr>';
echo '<th scope="col">Background Colour</th>';
echo '<td><input id="emp_background_colour" class="regular-text ltr emp_background_colour" name="emp_background_colour" type="input" value="'.$get_settings['emp_background_colour'].'"><p class="description">Do you want to set a background colour?</p></td>';
echo '</tr>';
echo '<th scope="col">Background Image </th>';
echo '<td><input id="upload_image_url" class="regular-text ltr" name="emp_background_image" type="input" value="'.$get_settings['emp_background_image'].'"><input id="upload_image_button" class="button" type="button" value="Upload Image" /><p class="description">Do you want to set a background image? This will override Background Colour.</p></td>';
echo '</tr>';
echo '<tr>';
echo '<th scope="col">Content</th>';
echo '<td>'.wp_editor( $get_settings[$editor_id] , $editor_id, $settings ).'</td>';
echo '</tr>';
echo '</tbody>';
echo '</table>';
$settings=array('wpcautop'=>false,'textarea\u name'=>$editor\u id);
回声';
回声';
回声';
回显“已启用”;
echo“是否要启用维护页面?
”;
回声';
回声';
回声“背景色”;
echo“是否要设置背景颜色?
”;
回声';
回波“背景图像”;
echo“是否要设置背景图像?这将覆盖背景色。
';
回声';
回声';
回应“内容”;
回显“”。wp_编辑器($get_settings[$editor_id],$editor_id,$settings)。“”;
回声';
回声';
回声';
内容得到了应有的处理,但由于某些原因,编辑器不在表格单元格内,而是位于实际表格的上方
你知道为什么吗?我看不到任何明显的问题,所以我想知道是否有我缺少的设置?在这里,您可以创建如下内容:
function editor_tobe_used($user)
{
if (!current_user_can('edit_posts')) {
return;
}
?>
<table class="form-table">
<tbody>
<tr>
<th scope="col">Enabled?</th>
<td><input name="emp_enabled" type="checkbox" value="checked" <?php echo $get_settings['emp_enabled'];?>'><p class="description">Do you want to enable Maintenance Page?</p></td>
</tr>
<tr>
<th scope="col">Background Colour</th>
<td><input id="emp_background_colour" class="regular-text ltr emp_background_colour" name="emp_background_colour" type="input" value="<?php $get_settings['emp_background_colour'];?>"><p class="description">Do you want to set a background colour?</p></td>
</tr>
<th scope="col">Background Image </th>
<td><input id="upload_image_url" class="regular-text ltr" name="emp_background_image" type="input" value="<?php $get_settings['emp_background_image'];?>"><input id="upload_image_button" class="button" type="button" value="Upload Image" /><p class="description">Do you want to set a background image? This will override Background Colour.</p></td>
</tr>
<tr>
<th scope="col">Content</th>
<td> <?php wp_editor( "Your content Goes here" , $editor_id, $settings );?></td>
</tr>
</tbody>
</table>
<?php
}
要使用的函数编辑器($user)
{
如果(!当前用户可以(‘编辑帖子’){
返回;
}
?>
启用?
首先,我想问题可能是,您应该为编辑器使用任意一个文本区域。@PranavBhatt请解释一下?您需要在表执行后回显编辑器。因此,通常建议使用div结构化表。任何一个都可以创建单独的函数而不回显表,只需使用wp_编辑器回显该函数即可。