Skip to content

Instantly share code, notes, and snippets.

@whyisjake
Created September 6, 2012 23:39
Show Gist options
  • Save whyisjake/3661419 to your computer and use it in GitHub Desktop.
Save whyisjake/3661419 to your computer and use it in GitHub Desktop.
<?php
add_action( 'init', 'make_register_cpt_slideshow' );
function make_register_cpt_slideshow() {
$labels = array(
'name' => _x( 'Slideshows', 'slideshow' ),
'singular_name' => _x( 'Slideshow', 'slideshow' ),
'add_new' => _x( 'Add New', 'slideshow' ),
'add_new_item' => _x( 'Add New Slideshow', 'slideshow' ),
'edit_item' => _x( 'Edit Slideshow', 'slideshow' ),
'new_item' => _x( 'New Slideshow', 'slideshow' ),
'view_item' => _x( 'View Slideshow', 'slideshow' ),
'search_items' => _x( 'Search Slideshows', 'slideshow' ),
'not_found' => _x( 'No slideshows found', 'slideshow' ),
'not_found_in_trash' => _x( 'No slideshows found in Trash', 'slideshow' ),
'parent_item_colon' => _x( 'Parent Slideshow:', 'slideshow' ),
'menu_name' => _x( 'Slideshows', 'slideshow' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
'capability_type' => 'post'
);
register_post_type( 'slideshow', $args );
}
add_filter( 'the_content', 'slideshow_content_filter', 5 );
function slideshow_content_filter( $content ) {
if ( 'slideshow' == get_post_type() ) {
$other_args = array(
'before' => '<div class="clear"></div><p>',
'after' => '</p>',
'link_before' => '<span class="badge">',
'link_after' => '</span>',
'next_or_number' => 'number',
'pagelink' => '%',
'echo' => 1
);
return $content.wp_link_pages($other_args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment