Skip to content

Instantly share code, notes, and snippets.

@ITfee
Created April 16, 2015 15:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ITfee/a72d2ec08c98eda40743 to your computer and use it in GitHub Desktop.
Save ITfee/a72d2ec08c98eda40743 to your computer and use it in GitHub Desktop.
WordPress Plugin Boilerplate for Custom Post Type "Advertorials" for self-marketing and client ads (e.g. whitepaper, promoting events or new releases).
<?php
/*
Plugin Name: Advertorials
Plugin URI: http://itfee.de/werbung-in-wordpress-per-custom-post-type-kennzeichnen/774
Description: Custom Post Type for self-marketing and client ads (e.g. whitepaper, promoting events or new releases)
Version: 0.1
Author: Roy Dittmann
Author URI: http://itfee.de
*/
if ( ! function_exists('advertorial_post_type') ) {
// Register Custom Post Type
function advertorial_post_type() {
$labels = array(
'name' => _x( 'Advertorials', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Advertorial', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Advertorial', 'text_domain' ),
'parent_item_colon' => __( 'Parent Advertorial:', 'text_domain' ),
'all_items' => __( 'All Advertorials', 'text_domain' ),
'view_item' => __( 'View Advertorial', 'text_domain' ),
'add_new_item' => __( 'Add New Advertorial', 'text_domain' ),
'add_new' => __( 'Add New', 'text_domain' ),
'edit_item' => __( 'Edit Advertorial', 'text_domain' ),
'update_item' => __( 'Update Advertorial', 'text_domain' ),
'search_items' => __( 'Search Advertorial', 'text_domain' ),
'not_found' => __( 'Not found', 'text_domain' ),
'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
);
$args = array(
'label' => __( 'advertorial', 'text_domain' ),
'description' => __( 'Post Type for self-marketing and client ads', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', ),
'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'menu_icon' => '',
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
);
register_post_type( 'advertorial', $args );
}
// Hook into the 'init' action
add_action( 'init', 'advertorial_post_type', 0 );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment