Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I'd recommend having the two groups of posts in different WordPress categories.
- Then you can use get_posts to pull back the two different lists and print them out however you want.
- After you created the CPT, do this for showing single posts of your CPT:
- Duplicate the single.php file in your template and rename it like single-{post_type}.php (eg. single-movie.php)
- Flush the permalinks from WordPress
- You can get more details from this post
- Now if you want to show a list of CPT you can use get_posts() with args:
- $args = array(
- ...
- 'post_type' => 'movie'
- )
- ----------------------------------------------------------
- <?php
- //A rough example
- $posts = get_posts(array(
- 'numberposts' => 5,
- 'category_name' => 'custom-posts-2',
- 'orderby' => 'post_date',
- 'order' => 'DESC'
- ));
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement