feat: add image filter (#476)

pull/480/head^2
Seaton Jiang 2022-02-20 23:20:15 +08:00
parent afae1de612
commit 4f88aa3580
No known key found for this signature in database
GPG Key ID: B79682F6FE8D30E3
2 changed files with 16 additions and 1 deletions

View File

@ -4,7 +4,7 @@
* 文章相关函数 * 文章相关函数
* @author Seaton Jiang <hi@seatonjiang.com> * @author Seaton Jiang <hi@seatonjiang.com>
* @license GPL-3.0 License * @license GPL-3.0 License
* @version 2022.01.26 * @version 2022.02.20
*/ */
// 文章链接添加 target 和 rel // 文章链接添加 target 和 rel
@ -454,6 +454,14 @@ function post_seo_callback($post)
echo '<input type="hidden" name="metaboxes_nonce" id="metaboxes_nonce" value="' . wp_create_nonce(plugin_basename(__FILE__)) . '" />'; echo '<input type="hidden" name="metaboxes_nonce" id="metaboxes_nonce" value="' . wp_create_nonce(plugin_basename(__FILE__)) . '" />';
} }
if (kratos_option('g_image_filter', true)) {
add_action( 'admin_footer-post-new.php', 'fanly_mediapanel_lock_uploaded' );
add_action( 'admin_footer-post.php', 'fanly_mediapanel_lock_uploaded' );
function fanly_mediapanel_lock_uploaded() {
echo '<script type="text/javascript">var $i=0;jQuery(document).on("DOMNodeInserted", function(){if(jQuery("#media-attachment-filters").length>0&&$i==0){jQuery(\'select.attachment-filters [value="uploaded"]\').attr(\'selected\',true).parent().trigger(\'change\');$i++;}});</script>';
}
}
function wpdocs_save_meta_box($post_id) function wpdocs_save_meta_box($post_id)
{ {
global $new_meta_boxes; global $new_meta_boxes;

View File

@ -639,6 +639,13 @@ CSF::createSection($prefix, array(
'subtitle' => __('启用/禁用文章自动保存、修订版本功能', 'kratos'), 'subtitle' => __('启用/禁用文章自动保存、修订版本功能', 'kratos'),
'default' => true, 'default' => true,
), ),
array(
'id' => 'g_image_filter',
'type' => 'switcher',
'title' => __('按类型筛选媒体库功能', 'kratos'),
'subtitle' => __('启用/禁用按类型筛选媒体库功能功能', 'kratos'),
'default' => true,
),
array( array(
'id' => 'g_article_widgets', 'id' => 'g_article_widgets',
'type' => 'image_select', 'type' => 'image_select',