AI摘要
TianliGPT
生成中...
示例

简单两步,代码实现:
1、将以下代码直接放到 zibllincoptionsmetabox-options.php 下方:
//META BOX SETTINGCSF::createMetabox('mrhe_jingxuan', array('title' => '精选','post_type' => array('post', 'page', 'plate', 'forum_post'),'context' => 'advanced','data_type' => 'unserialize',));CSF::createSection('mrhe_jingxuan', array('fields' => array(array('title' => __('是否精选文章', 'https://hexsen.com'),'id' => 'jx','type' => 'Checkbox','label' => '是否精选文章','default' => false // or false),),));//META BOX SETTING CSF::createMetabox('mrhe_jingxuan', array( 'title' => '精选', 'post_type' => array('post', 'page', 'plate', 'forum_post'), 'context' => 'advanced', 'data_type' => 'unserialize', )); CSF::createSection('mrhe_jingxuan', array( 'fields' => array( array( 'title' => __('是否精选文章', 'https://hexsen.com'), 'id' => 'jx', 'type' => 'Checkbox', 'label' => '是否精选文章', 'default' => false // or false ), ), ));//META BOX SETTING CSF::createMetabox('mrhe_jingxuan', array( 'title' => '精选', 'post_type' => array('post', 'page', 'plate', 'forum_post'), 'context' => 'advanced', 'data_type' => 'unserialize', )); CSF::createSection('mrhe_jingxuan', array( 'fields' => array( array( 'title' => __('是否精选文章', 'https://hexsen.com'), 'id' => 'jx', 'type' => 'Checkbox', 'label' => '是否精选文章', 'default' => false // or false ), ), ));
2、将以下代码放到 zib-posts-list.php 文件中,如图位置:
if (get_post_meta($post->ID, 'jx', true)){$sticky .= '<badge class="img-badge right jb-red"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-hot"></use></svg> 精选</badge>';}if (get_post_meta($post->ID, 'jx', true)){ $sticky .= '<badge class="img-badge right jb-red"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-hot"></use></svg> 精选</badge>'; }if (get_post_meta($post->ID, 'jx', true)){ $sticky .= '<badge class="img-badge right jb-red"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-hot"></use></svg> 精选</badge>'; }

就这么简单,只需要在主题自带的编辑器里面点击编辑即可看见该选项(子比用户的前台没有这个功能,只能后台使用)
感谢您的来访,获取更多精彩文章请收藏本站。


暂无评论内容