Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
e78665fe71
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
85 lines (76 sloc) 2.15 KB
<?php
/**
* Plugin Name: UC Guides
* Description: Awesome!
* Version: 1.0
* Author: Chris Cerrigione and Andrew Bacon
*/
function create_custom_guide_post_type(){
$labels = array(
'name' => 'Guides',
'singular_name' => 'Guide',
'add_new' => 'New Guide',
'add_new_item' => 'Add New Guide',
'edit_item' => 'Edit Guide',
'view_item' => 'View Guide',
'search_items' => 'Search Guides'
);
$args = array(
'label' => 'Guides',
'labels' => $labels,
'description' => 'Awesome',
'public' => true,
'menu_position' => 35,
'menu_icon' => 'dashicons-media-document',
'supports' => array( 'title','tags', 'thumbnail', 'revisions', 'page-attributes','author', 'editor' ),
'has_archive' => true
);
register_post_type( 'guide', $args );
register_taxonomy( 'guide_category', 'guide',
array(
'label' => 'Guide Categories',
'labels' => array(
'name' => 'Guide Categories',
'singular_name' => 'Guide Category',
'search_items' => 'Search Guide Categories',
'edit_item' => 'Edit Guide Category',
'view_item' => 'View Guide Category',
'update_item' => 'Update GuideCategory',
'add_new_item' => 'Add new Guide Category',
'new_item_name' => 'New Guide Category'
),
'public' => true,
'hierarchical' => true,
'rewrite' => array('hierarchical' => true )
)
);
register_taxonomy( 'guide_tag', 'guide',
array(
'label' => 'Tags',
'labels' => array(
'name' => 'Tags',
'singular_name' => 'Tag',
'search_items' => 'Search Tags',
'edit_item' => 'Edit ',
'view_item' => 'Tag.viewitem',
'update_item' => 'Update Tag',
'add_new_item' => 'Add new tags',
'new_item_name' => 'Tag.newitemname'
),
'public' => true,
'hierarchical' => false
)
);
}
add_action( 'init', 'create_custom_guide_post_type', 0 );
// Add Page template via plugin...
//http://wordpress.stackexchange.com/questions/3396/create-custom-page-templates-with-plugins
function wpa3396_page_template( $page_template )
{
if ( is_page( 'guides-2' ) ) {
$page_template = dirname( __FILE__ ) . '/page-guidesearch.php';
}
return $page_template;
}
add_filter( 'page_template', 'wpa3396_page_template' );
?>