I've got a custom post type I need to set to 'display all posts'. In Reading I've set it to 10 due to only wanting 10 posts on the blog page. How do I set the maximum posts on the CPT page? I've found this code...
$args = array('post_type' => 'portfolio',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'portfolio',
'field' => 'slug',
)
)
)
$query = new WP_Query($args)
I'm new to php so I'm unsure where I add this - functions.php in the 'register CPT' or in the loop on the archive page? The loop is quite complicated as I'm pulling in 3 taxonomies and setting values each time.
<?php $i = 0; ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
$i++;
$term_list1 = wp_get_post_terms($post->ID, 'discipline', array("fields" => "ids"));
$term_list2 = wp_get_post_terms($post->ID, 'type', array("fields" => "ids"));
$term_list3 = wp_get_post_terms($post->ID, 'sector', array("fields" => "ids"));
?>
<li class="item" data-id="id-<?php echo $i; ?>" data-type='<?php foreach ($term_list1 as $value) {echo $value." ";} ?><?php foreach ($term_list2 as $value) {echo $value." ";} ?><?php foreach ($term_list3 as $value) {echo $value." ";} ?>'>
<a href="<?php the_permalink() ?>"><?php the_post_thumbnail(); ?></a>
</li>
<?php endwhile; else : ?>
<?php endif; ?>
Any help would be appreciated, thanks.