-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomize-mu-plugin.php
51 lines (42 loc) · 1.3 KB
/
customize-mu-plugin.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
<?php
/**
* Plugin Name: Fictioneer Customization
* Description: Scripts to customize the theme or child theme.
* Version: 1.0.0
* Author: YOUR NAME
* License: GNU General Public License v3.0 or later
* License URI: http://www.gnu.org/licenses/gpl.html
*/
/**
* Adds actions and filters after the theme has loaded
* and all hooks have been registered
*/
function custom_initialize() {
// add_filter( 'fictioneer_filter_post_meta_items', 'custom_modify_post_meta_items' );
}
add_action( 'after_setup_theme', 'custom_initialize', 99 );
/**
* Removes the icons from the post meta row and separates the items with a "|"
*
* Note: Add ".post__meta { gap: .5rem; }" under Appearance > Customize > Custom CSS.
*
* @param array $output The HTML of the post meta items to be rendered.
*
* @return array The updated items.
*/
function custom_modify_post_meta_items( $output ) {
// Remove icons
$output = array_map( function( $item ) { return preg_replace( '/<i[^>]*>.*?<\/i>/', '', $item ); }, $output );
$count = 0;
$new_output = [];
// Add slashes as divider
foreach ( $output as $key => $value ) {
if ( $count > 0 ) {
$new_output[ $key . '_slash' ] = '<span class="divider">|</span>';
}
$new_output[ $key ] = $value;
$count++;
}
// Continue filter
return $new_output;
}