Skip to content

Instantly share code, notes, and snippets.

@hborrelli1
Created November 15, 2018 18:32
Show Gist options
  • Save hborrelli1/7ce6e967ca9999653187ed501cdf31f5 to your computer and use it in GitHub Desktop.
Save hborrelli1/7ce6e967ca9999653187ed501cdf31f5 to your computer and use it in GitHub Desktop.
<?php
/**
* Your code here.
*
*/
/* Adding SVG's to WP */
function add_file_types_to_uploads($file_types){
$new_filetypes = array();
$new_filetypes['svg'] = 'image/svg+xml';
$file_types = array_merge($file_types, $new_filetypes );
return $file_types;
}
add_action('upload_mimes', 'add_file_types_to_uploads');
/* End of Adding SVG's to WP */
/********************************************
# - Custom Post Types
*********************************************/
add_action( 'init', 'codex_book_init' );
/**
* Register a gallery post type.
*
* @link http://codex.wordpress.org/Function_Reference/register_post_type
*/
function codex_book_init() {
$labels = array(
'name' => _x( 'Gallery', 'post type general name', 'the7dtchild' ),
'singular_name' => _x( 'DSPE_Gallery', 'post type singular name', 'the7dtchild' ),
'menu_name' => _x( 'Gallery', 'admin menu', 'the7dtchild' ),
'name_admin_bar' => _x( 'Gallery', 'add new on admin bar', 'the7dtchild' ),
'add_new' => _x( 'Add New', 'gallery item', 'the7dtchild' ),
'add_new_item' => __( 'Add New Gallery Item', 'the7dtchild' ),
'new_item' => __( 'New Gallery Item', 'the7dtchild' ),
'edit_item' => __( 'Edit Gallery Item', 'the7dtchild' ),
'view_item' => __( 'View Gallery Item', 'the7dtchild' ),
'all_items' => __( 'All Gallery Items', 'the7dtchild' ),
'search_items' => __( 'Search Gallery', 'the7dtchild' ),
'parent_item_colon' => __( 'Parent Gallery:', 'the7dtchild' ),
'not_found' => __( 'No gallery item found.', 'the7dtchild' ),
'not_found_in_trash' => __( 'No gallery item found in Trash.', 'the7dtchild' )
);
$args = array(
'labels' => $labels,
'description' => __( 'Description.', 'the7dtchild' ),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'gallery' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => true,
'menu_position' => null,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'page-attributes', 'post_formats' ),
'taxonomies' => array( 'category','post_tag' )
);
register_post_type( 'dspe_gallery', $args );
}
/********************************************
# - End of Custom Post Types
*********************************************/
/* Adding page options to Custom Post Type */
function add_dt_metaboxes_custom( $pages ) {
$pages[] = 'dspe_gallery';
return $pages;
}
add_filter( 'presscore_pages_with_basic_meta_boxes', 'add_dt_metaboxes_custom' );
/* End of Adding page options to Custom Post Type */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment