Reputation: 136
I have problem with ACF in Wordpress. I created own field And created own plugin to display it, but I don't know how I can display all my fields. Now I have something like this:
wp_reset_postdata();
$myargs = array (
'showposts' => 6
);
$myquery = new WP_Query($myargs);
if($myquery->have_posts() ) :
while($myquery->have_posts() ) : $myquery->the_post();
?>
<p>
<?php the_title(); ?>
</p>
<?php endwhile;
endif;
wp_reset_postdata();
And this display me all posts. I want to display posts only from category "Raporty" and I want to display all of my custom fields.
Sorry for my english ;)
Upvotes: 0
Views: 565
Reputation: 287
Siema Kubol,
to show posts only with post_type 'raporty' add it to $myargs
:
$myargs = array (
'showposts' => 6,
'post_type' => 'raporty'
);
In wp loop you could just use e.g. get_field( 'typ_raportu' )
. Outside loop get_field( 'typ_raportu', post_id_here )
.
Upvotes: 1