欢迎来到路由器窝!

列表描述改编辑器

浏览次数:

作者: 小编

信息来源:

更新日期: 2023-03-07 10:04

文章简介

///描述改编辑器add_action("category_edit_form_fields", ‘edit_form_fields_example‘, 10, 2);add_action("category_add_for

  • 正文开始
  • 相关文章
///描述改编辑器
/**
 * wordpress分类目录添加可视化编辑器
 * 
 */
// 移除HTML过滤
remove_filter( 'pre_term_description', 'wp_filter_kses' );
remove_filter( 'term_description', 'wp_kses_data' );
//为分类编辑界面添加可视化编辑器的“描述”框
add_filter('edit_category_form_fields', 'cat_description');
function cat_description($tag)
{
	?>
	<table class="form-table">
		<tr class="form-field">
			<th scope="row" valign="top"><label for="description"><?php _ex('Description', 'Taxonomy Description'); ?></label></th>
			<td>
				<?php
				$settings = array('wpautop' => true, 'media_buttons' => true, 'quicktags' => true, 'textarea_rows' => '15', 'textarea_name' => 'description' );
				wp_editor(wp_kses_post($tag->description , ENT_QUOTES, 'UTF-8'), 'cat_description', $settings);
				?>
				<br />
				<span class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></span>
			</td>
		</tr>
	</table>
	<?php
}
//移除默认的“描述”框
add_action('admin_head', 'remove_default_category_description');
function remove_default_category_description()
{
	global $current_screen;
	if ( $current_screen->id == 'edit-category' )
	{
		?>
		<script type="text/javascript">
			jQuery(function($) {
				$('textarea#description').closest('tr.form-field').remove();
			});
		</script>
		<?php
	}
}

functions.php添加函数即可

转载请注明:Wordpress» 列表描述改编辑器

标签:
上一页:纯代码实现WordPress分类目录添加缩略图片上传功能
下一页:id 子栏目三级 判断有无子栏目显示样式 序号输出
最近更新作品
acf判断
更新时间:2024-04-17

892人已经看过了!

指定栏目ID另类调用配合acf
更新时间:2024-04-16

857人已经看过了!

word press 自定义文章类型制作留言功能
更新时间:2024-03-10

985人已经看过了!

php if  ifelse 循环
更新时间:2024-03-09

576人已经看过了!

栏目模板选择插件栏目模板
更新时间:2024-03-08

738人已经看过了!

contact-form-7历史版本WP SMTP配合使用
更新时间:2024-03-08

809人已经看过了!

WordPress True / False功能参数
更新时间:2024-03-08

930人已经看过了!

wordpress调用指定分类置顶文章
更新时间:2024-03-07

519人已经看过了!

WordPress父分类调用子分类名称和文章列表
更新时间:2024-03-07

520人已经看过了!