-
Notifications
You must be signed in to change notification settings - Fork 0
/
enable-all-post-formats.php
49 lines (46 loc) · 1.35 KB
/
enable-all-post-formats.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
<?php
/**
* Plugin Name: Enable All Post Formats
* Plugin URI: https://github.com/nickbohle/Enable-All-Post-Formats/
* Description: A simple plugin to enable all post formats in WordPress.
* Version: 1.0
* Author: Nick Bohle
* Author URI: https://nickbohle.de/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: enable-all-post-formats
*/
// Hook into 'after_setup_theme' to add post formats support
add_action('after_setup_theme', 'enable_all_post_formats');
function enable_all_post_formats() {
// Check if the current theme supports 'post-formats'
if (current_theme_supports('post-formats')) {
// Define an array of all available post formats
$formats = array(
'aside',
'gallery',
'link',
'image',
'quote',
'status',
'video',
'audio',
'chat'
);
// Add support for all post formats
add_theme_support('post-formats', $formats);
} else {
// Add post formats support if the theme does not support it yet
add_theme_support('post-formats', array(
'aside',
'gallery',
'link',
'image',
'quote',
'status',
'video',
'audio',
'chat'
));
}
}