I have created a custom post type that I want to use to allow people to add an arbitrary number of sections to the homepage of my theme. I want to loop through all posts of that type and include their contents in the page. My problem is that calling
'post_type' => 'home_section' seems to be returning a boolean, not an array.
Here is the code I'm using to test:
<?php $hp_sections = get_pages(array('post_type' => 'home_section')); echo '<!-- $hp_sections type: ', gettype($hp_sections), ', value: ', $hp_sections, ' -->'; ?>
When I view source on my page I get:
<!-- $hp_sections type: boolean, value: -->
I'm pretty new to both PHP and Wordpress so I'm assuming I'm making some sort of dumb mistake. I'd like to know both what is wrong with the above code and what the recommended way to get all pages of a given type and iterate over them inside a template is.