欢迎来到路由器窝!

列表描述改编辑器

浏览次数:

作者: 小编

信息来源:

更新日期: 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» 列表描述改编辑器

标签:
  • logo设置
    735阅读
    function p_curr_link( $i) {echo '<li><span class="page-numbers current">'.$i.'</span></li>';}//添加logo $args = ...
  • 添加栏目编辑器
    532阅读
    //添加栏目编辑器add_action("category_edit_form_fields", 'add_form_fields_example', 10, 2);function add_form_fields_example($term, $taxonomy){echo '<tr val...
  • wordpress常用函数
    227阅读
    ?phprequire get_template_directory() . /inc/helper.php;add_filter(acf/settings/path, my_acf_settings_path); function my_acf_settings_path( $path ) { $path = get...
  • wordpress手机端主题插件WP Mobile X
    173阅读
    WP Mobile X是一款国产的手机端主题切换插件,通过该插件可以专门为手机端启用一个指定的wordpress主题,同时不会影响PC电脑端主题的正常运行,其功能类似于博客吧前面介绍的 MobilePress插件 和 DW Mobile Switcher插件 。WP Mobile X插件内置一款移动端主
  • 分类栏目图片插件
    716阅读
    调用方法<?php get_cat_icon(); ?>
  • 纯代码实现WordPress分类目录添加缩略图片上传功能
    917阅读
    打开自己正在启用的wordpress主题目录下的functions.php文件,加入扩展目录文件require get_template_directory() . '/inc/images.php';调用方法<img src="<?php if (function_exists(...
  • wordpress自定义菜单
    813阅读
    注册菜单if(function_exists('register_nav_menus')){register_nav_menus(array('header-menu' => __( '导航自定义菜单' ),));}调用菜单<?php wp_nav_menu(...
  • 添加基本编辑字段公共字段
    710阅读
    //添加自定义字段function my_profile( $contactmethods ) {$contactmethods['tel'] = 'tel'; //增加$contactmethods['fax'] = 'fax';$contactmeth...
  • 栏目分类添加自定义字段两个
    1008阅读
    // 分类添加字段function ems_add_category_field(){echo '<div class="form-field"><label for="cat-keywords">头部文字</label><tex...
  • 后台菜单a标签添加样式
    686阅读
    function xintheme_menu_link_atts( $atts, $item, $args ) { $atts['class'] = 'menu-link'; $atts['data-link-alt'] = $item->title; ret...
上一页:纯代码实现WordPress分类目录添加缩略图片上传功能
下一页:id 子栏目三级 判断有无子栏目显示样式 序号输出
最近更新作品
wordpress自定义菜单
更新时间:2023-03-09

813人已经看过了!

id 子栏目三级 判断有无子栏目显示样式 序号输出
更新时间:2023-03-08

581人已经看过了!

列表描述改编辑器
更新时间:2023-03-07

733人已经看过了!

纯代码实现WordPress分类目录添加缩略图片上传功能
更新时间:2023-03-07

917人已经看过了!

contact-form-7更改默认的rows和cols的值
更新时间:2022-09-29

764人已经看过了!

栏目分类添加自定义字段两个
更新时间:2022-09-29

1008人已经看过了!

添加基本编辑字段公共字段
更新时间:2022-09-29

710人已经看过了!

添加栏目编辑器
更新时间:2022-09-29

532人已经看过了!

后台菜单a标签添加样式
更新时间:2022-09-29

686人已经看过了!

分类栏目图片插件
更新时间:2022-09-29

716人已经看过了!