I'm trying to make the following mock up with WordPress: https://i.sstatic.net/wyYS1.jpg
I created a custom post type and I created two categories (general and filling instructions). I used ACF plugin to create custom fields for the post type: https://i.sstatic.net/xBn3S.jpg
However, when I create the loop I can't get it to show posts for only the general category, it will show any category. Also, it only shows one post (most recent), I want it to show all of them for the one category.
<ul class="pdfLinks">
<?php
//The Arguments
$args = array(
'posts_per_page' => 50,
'post_type' => 'documents',
'category_name' => 'general'
);
//The Query
$genral_documents = new WP_Query ( $args ); ?>
<?php
//If we have the posts...
if (the_field ('title')) :
while(the_field('title')) :
the_field('title');
endwhile;
endif;
?>
<?php
$pdf1 = get_field('pdf_1');
?>
<a class="download_button" target="_blank" href="<?php echo $pdf1['url']; ?>">
<li>
Download File
</li>
</a>
</ul>
I'm very new to coding for WordPress, so I'm not sure what I'm doing wrong. Thank you for your help :)
category_*
parameters only work for the built-in Categories ( used for posts ). I'm assuming you have a Custom Taxonomy and thus need to use atax_query
.meta_*
properties of WP_Query. You also have Term ID as the selected value so you won't be able to use the slug.