I’m outputting a bunch of custom post types within a page. How do I get all the titles of the posts within this current page?
Leave a Reply
You must be logged in to post a comment.
I’m outputting a bunch of custom post types within a page. How do I get all the titles of the posts within this current page?
You must be logged in to post a comment.
You should look at WP_Query() for outputting custom post types. The code below gets all of your custom posts of the type ‘custom_post_type’, puts them in a variable called $loop and iterates through it, outputting the title of each post contained within.
There are other arguments that you can pass in to WP_Query() to make it more suitable for your needs. Documentation can be found here.
Right before ‘The Loop’, you might as well just use: