Relationship Loop
-
I have created the realationship field with ACF and i want just to show the first post i have chose it and then 2 other on the next page and the the rest. I have make it before with query offset=1 offset=3 but with ACF i donw knot how to do it.
Thank you
My code:
<?php foreach( $posts as $post): ?> <div id="lajme-bllok-item-vogel"> <?php $prop_slider = get_field('id_slider'); if( $prop_slider != '' ){ echo do_shortcode("[metaslider id=".$prop_slider."]"); } else { ?> <a href="<?php the_permalink($post->ID); ?>"><?php the_post_thumbnail($post_id, 'lajmet-thumb'); ?></a> <?php } ?> <div id="lajme-bllok-item-title-vogel"><a href="<?php echo the_permalink($post->ID); ?>"><?php the_title($post->ID); ?></a> <?php $prop_det_url_foto = get_field('link_foto'); if( $prop_det_url_foto != '' ){ ?><a class="linkfoto" href="<?php echo $prop_det_url_foto;?>">Foto</a><?php } ?> <?php $prop_det_url_video = get_field('link_video'); if( $prop_det_url_video != '' ){ ?>- <a class="linkvideo" href="<?php echo $prop_det_url_video;?>">Video</a><?php } ?> <div id="top-news-title-linku-posht"> <?php $prop_det_url_pershkrim = get_field('link_pershkrimi'); if( $prop_det_url_pershkrim != '' ){ ?><?php echo $prop_det_url_pershkrim;?><?php } ?></div> <div id="top-news-title-linku-posht"><?php for( $i=1; $i<=4; $i++){ $prop_det_url = get_field('link'.$i); if( $prop_det_url != '' ){ ?> <li><a href="<?php echo $prop_det_url; ?>" target="_blank"><?php the_field('link_titull'.$i); ?></a></li> <?php } } ?> </div> </div> <div id="social-media-vogel"> <span class='st_facebook' st_image='<?php the_post_thumbnail('lajmet-thumb'); ?>' st_title='<?php the_title(); ?>' st_url='<?php the_permalink(); ?>'></span> <span st_via='@oranewsrtv' st_username='oranewsrtv' class='st_twitter' st_title='<?php the_title(); ?>' st_url='<?php the_permalink(); ?>'></span> <span class='st_googleplus' st_title='<?php the_title(); ?>' st_url='<?php the_permalink(); ?>'></span> <a style="float:right;" href="<?php the_permalink(); ?>#comment"><?php comments_number( 'Komento (0)', 'Komento (1)', 'Komento(%)' ); ?></a></div> </div> <?php endforeach; ?> <?php endif; ?>
The topic ‘Relationship Loop’ is closed to new replies.