pobranie wybranych wpisów na dowolną stronę – custom field Wpis – Post Object

dodajemy w panelu custom field Wpis – Post Object i w kodzie strony wstawiamy:


<!-- start get data of post -->
<?php $post_object = get_sub_field('your_field_name');
if( $post_object ):
    $post = $post_object;
    setup_postdata( $post ); ?>

        <a href="<?php the_permalink();?>" title="<?php the_title(); ?>">
            <?php if ( has_post_thumbnail() ) { the_post_thumbnail(); }
            else { ?><img src="<?php bloginfo('template_url');?>/images/blind.png" alt="maszyny do sitodruku"/><?php ; } ?>
        </a>
        <h4><a href="<?php the_permalink();?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h4>
        <?php if(get_field('type')): ?><h5><?php echo get_field('type');?></h5><?php endif; ?>

    <?php wp_reset_postdata(); ?>
<?php endif; ?><!-- end get data of post -->