WordPress Custom Posttype

// Our custom post type function movie function create_posttype_movies() { register_post_type( 'movie', // CPT Options array( 'labels' => array( 'name' => __( 'Movies' ), 'singular_name' => __( 'movie' ) ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'movie'), ) ); } add_action( 'init', 'create_posttype_movies' ); // Create Movies Taxonomy function my_taxonomies_movies() { $labels = array( 'name' => _x( 'Movies Categories', 'taxonomy general name' ), 'singular_name' => _x( 'Movie Category', 'taxonomy singular name' ), 'menu_name' => __( 'Movie Categories' ), ); $args = array( 'labels' => $labels, 'hierarchical' => true, ); register_taxonomy( 'movies_category', 'movie', $args ); } add_action( 'init', 'my_taxonomies_movies', 0 ); /*Display Custom Post Type*/ <?php $args = array('post_type' => "meetings", 'posts_per_page' => -1, 'orderby'=>"title", 'order'=>"asc"); $postType = new WP_Query( $args ); if( $postType->have_posts() ) { while( $postType->have_posts() ) { $postType->the_post(); ?> <?php the_title();?> <?php the_content();?> <?php } } wp_reset_query(); ?>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.