Created
February 23, 2018 17:08
-
-
Save mihir1337/8e2f2f6b52683db18a552ae0e11be1f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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