Skip to content

Instantly share code, notes, and snippets.

@ianmjones
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianmjones/dab03cfc60ed0296c0b5 to your computer and use it in GitHub Desktop.
Save ianmjones/dab03cfc60ed0296c0b5 to your computer and use it in GitHub Desktop.
A tiny little article plugin to demo Extended CPTs ... with translatable labels.
<?php
/**
* @link https://deliciousbrains.com/blog/
* @since 1.0
* @package Pixie_Article
*
* @wordpress-plugin
* Plugin Name: Pixie Article
* Plugin URI: https://deliciousbrains.com/blog/
* Description: A tiny little article plugin to demo Extended CPTs.
* Version: 1.0
* Author: ianmjones
* Author URI: https://profiles.wordpress.org/ianmjones
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: pixie-article
* Domain Path: /languages
* Network: False
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
function pixie_article_loaded() {
require_once( 'extended-cpts/extended-cpts.php' );
load_plugin_textdomain(
'pixie-article',
false,
dirname( plugin_basename( __FILE__ ) ) . '/languages/'
);
$labels = array(
'name' => __( 'Pixie Articles', 'pixie-article' ),
'singular_name' => __( 'Pixie Article', 'pixie-article' ),
'menu_name' => __( 'Pixie Articles', 'pixie-article' ),
'add_new' => _x( 'Add New', 'Pixie Article', 'pixie-article' ),
'add_new_item' => __( 'Add New Pixie Article', 'pixie-article' ),
'edit_item' => __( 'Edit Pixie Article', 'pixie-article' ),
'new_item' => __( 'New Pixie Article', 'pixie-article' ),
'view_item' => __( 'View Pixie Article', 'pixie-article' ),
'search_items' => __( 'Search Pixie Articles', 'pixie-article' ),
'not_found' => __( 'No pixie articles found', 'pixie-article' ),
'not_found_in_trash' => __( 'No pixie articles found in Trash', 'pixie-article' ),
'parent_item_colon' => __( 'Parent Pixie Article:', 'pixie-article' ),
'all_items' => __( 'All Pixie Articles', 'pixie-article' ),
);
register_extended_post_type( 'pixie-article', array( 'labels' => $labels ) );
}
add_action( 'plugins_loaded', 'pixie_article_loaded' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment