-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunmus_editor.php
69 lines (56 loc) · 1.62 KB
/
unmus_editor.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/**
* Editor Enhancements
*
* @package unmus
* @since 0.7
*/
// Security: Stops code execution if WordPress is not loaded
if (!defined('ABSPATH')) { exit; }
/**
* Add Post Format Filter to Ello Table View
*
* @param string Post Type
*/
function unmus_ello_post_format_filter($post_type = "") {
if ( in_array( $post_type, array( 'ello' ) ) ) {
wp_dropdown_categories( array(
'taxonomy' => 'post_format',
'hide_empty' => 0,
'name' => 'post_format',
'show_option_all' => 'Post Format',
'value_field' => 'slug',
) );
}
}
add_action( 'restrict_manage_posts', 'unmus_ello_post_format_filter');
/**
* Remove Post Format Option in Editor for Standard Post Type
*
* Why?
* 1 - Standard Posts do not have Post Formats at unmus
* 2 - But Theme huhu provides post format support for standard posts
*
* @since 0.2
*/
function unmus_remove_post_formats_for_standard_posts_in_editor () {
global $pagenow;
if ( 'post.php' === $pagenow && isset($_GET['post']) && 'post' === get_post_type( $_GET['post'] ) ) {
remove_theme_support('post-formats');
}
}
add_action( 'admin_init', 'unmus_remove_post_formats_for_standard_posts_in_editor' );
/**
* Show Custom Fields Meta Box in Editor
*
* ACF plugin disables the meta box for better performance as default
* Filter below activates it again
*
* @since 0.5
* @see Advanced Custom Fields Plugin
* @link https://www.advancedcustomfields.com
*/
if ( class_exists( 'ACF' ) ) {
add_filter( 'acf/settings/remove_wp_meta_box', '__return_false' );
}
?>