Skip to content

Instantly share code, notes, and snippets.

@mihir1337
Created February 23, 2018 17:08
Show Gist options
  • Select an option

  • Save mihir1337/8e2f2f6b52683db18a552ae0e11be1f9 to your computer and use it in GitHub Desktop.

Select an option

Save mihir1337/8e2f2f6b52683db18a552ae0e11be1f9 to your computer and use it in GitHub Desktop.
/**
* Registers a new post type
**/
function prefix_register_name() {
// Slider coustom post
register_post_type('slide', array(
'public' => true,
'label' => 'Slide',
'labels' => array(
'name' => 'Slides',
'singular_name' => 'Slide',
'add_new' => 'Add new slide'
),
'supports' => array(
'title',
'editor',
'thumbnail',
'excerpt',
)
));
}
add_action( 'init', 'prefix_register_name' );
// Query
<?php query_posts( array(
'post_type' => 'Name',
'posts_per_page' => 'number',
) ); ?>
<?php while(have_posts()) : the_post(); ?>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment