欢迎来到路由器窝!

添加栏目编辑器

浏览次数:

作者: 小编

信息来源:

更新日期: 2022-09-29 10:57

文章简介

//添加栏目编辑器add_action("category_edit_form_fields", ‘add_form_fields_example‘, 10, 2);function add_form_fields_example($

  • 正文开始
  • 相关文章
/**
 * 为 WordPress 分类目录的描述添加可视化编辑器echo term_description( $term_id, 'category' );
 */
// 移除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
	}
}

调用方法

<?php echo term_description( $term_id, 'category' ); ?>


转载请注明:Wordpress» 添加栏目编辑器

标签:
  • 分页函数
    1011阅读
    //在网站后台设置--阅读-设置每页显示文章数量,当达到这个数量后,自动分页显示。function MBThemes_paging() {$p = 3;if ( is_singular() ) return;global $wp_query, $paged;$max_page = $wp_query->max_n...
  • 分类栏目图片插件
    722阅读
    调用方法<?php get_cat_icon(); ?>
  • WordPress获取当前页面URL地址的方法
    224阅读
    ?php // 说明:获取完整URL function curPageURL() { $pageURL = http; if ($_SERVER[HTTPS] == on) { $pageURL .= s; } $pageURL .= ://; if ($_SERVER[SERVER_PORT] != 80) { $p...
  • WordPress——判断文章中是否有图片
    172阅读
    首先在functions.php添加以下代码: /***判断文章中是否有图片*/function is_has_image(){ if ( is_single () || is_page()) { global $post; if( has_post_thumbnail() ) return true; $conten...
  • 添加栏目编辑器
    542阅读
    //添加栏目编辑器add_action("category_edit_form_fields", 'add_form_fields_example', 10, 2);function add_form_fields_example($term, $taxonomy){echo '<tr val...
  • 提交留言-安装超级留言插件
    212阅读
    form action=/wp-comments-post.php class=form-horizontal method=post name=myform id=commentform style= width: 90%; margin: 40px auto 0; input type=hidden name=re...
  • wordpress不同分类调用不同模板
    218阅读
    用wordpress做网站特别是企业网站建设的时候,多个分类的内容不同需要显示的页面也不一样,比如有些分类显示的是产品缩略图,有些显示的是公司新闻公告等,此时需要不同的分类模板。 虽然wordpress默认只有一个通用的分类目录模板(archive.php),但是可以通
  • WordPress 无插件 纯代码实现分页导航
    182阅读
    第一步:将以下代码放到自己使用的wordpress主题的模板函数文件functions.php中。 function kriesi_pagination($query_string){global $posts_per_page, $paged;$my_query = new WP_Query($query_strin...
  • 添加基本编辑字段公共字段
    717阅读
    //添加自定义字段function my_profile( $contactmethods ) {$contactmethods['tel'] = 'tel'; //增加$contactmethods['fax'] = 'fax';$contactmeth...
  • wordpress常用函数
    234阅读
    ?phprequire get_template_directory() . /inc/helper.php;add_filter(acf/settings/path, my_acf_settings_path); function my_acf_settings_path( $path ) { $path = get...
上一页:后台菜单a标签添加样式
下一页:添加基本编辑字段公共字段
最近更新作品
wordpress自定义菜单
更新时间:2023-03-09

824人已经看过了!

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

590人已经看过了!

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

742人已经看过了!

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

930人已经看过了!

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

774人已经看过了!

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

1017人已经看过了!

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

717人已经看过了!

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

542人已经看过了!

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

691人已经看过了!

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

722人已经看过了!