Skip to content

Instantly share code, notes, and snippets.

View kp-emagine's full-sized avatar
💭
I may be slow to respond.

Kevin Pirnie kp-emagine

💭
I may be slow to respond.
View GitHub Profile
@kp-emagine
kp-emagine / clean-svg-func.php
Created March 25, 2021 15:33
Wordpress Sanitize SVGs
function clean_svg( string $_svg_xml ) : string {
// common attributes, these mainly apply to shape based elements
$_common = array(
'id' => true,
'class' => true,
'style' => true,
'tabindex' => true,
'clip-path' => true,
'color' => true,
@kp-emagine
kp-emagine / gist:fe16163b49c63321ff5fd1552813acb8
Created June 29, 2018 11:35
Adding Multiple "Featured" Images to Posts
function add_featured_images ( $howmany = 1 ) {
global $imgs;
$imgs = $howmany;
// add the meta boxes
add_action( 'add_meta_boxes', function( ) {
global $imgs;
// what post types do we want to allow this on?
$post_types = array( 'post', 'page' );
foreach( $post_types as $pt ){
add_meta_box( 'custom_postimage_meta_box', __( ucfirst( $pt ) . ' Images' ), function( $post ) {