Skip to content

Commit

Permalink
feat: add image filter (#476)
Browse files Browse the repository at this point in the history
  • Loading branch information
seatonjiang committed Feb 20, 2022
1 parent afae1de commit 4f88aa3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 9 additions & 1 deletion inc/theme-article.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 文章相关函数
* @author Seaton Jiang <[email protected]>
* @license GPL-3.0 License
* @version 2022.01.26
* @version 2022.02.20
*/

// 文章链接添加 target 和 rel
Expand Down Expand Up @@ -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__)) . '" />';
}

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)
{
global $new_meta_boxes;
Expand Down
7 changes: 7 additions & 0 deletions inc/theme-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,13 @@ function getrobots()
'subtitle' => __('启用/禁用文章自动保存、修订版本功能', 'kratos'),
'default' => true,
),
array(
'id' => 'g_image_filter',
'type' => 'switcher',
'title' => __('按类型筛选媒体库功能', 'kratos'),
'subtitle' => __('启用/禁用按类型筛选媒体库功能功能', 'kratos'),
'default' => true,
),
array(
'id' => 'g_article_widgets',
'type' => 'image_select',
Expand Down

0 comments on commit 4f88aa3

Please sign in to comment.