WordPress Custom Posttype

// Our custom post type function function create_posttype_meetings() { register_post_type( 'meetings', // CPT Options array( 'labels' => array( 'name' => __( 'Meetings' ), 'singular_name' => __( 'Meeting' ) ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'meetings'), ) ); } // Hooking up our function to theme setup add_action( 'init', 'create_posttype_meetings' ); /*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.