Home › Forums › General Issues › Multiple Post Object in Group › Reply To: Multiple Post Object in Group
Hi, it not allow multiple selections, single selection for each post object (shared in 2nd reply).
Here what i have tried, seems to work now:
// Shortcode [post_grid]
if ( ! function_exists('post_grid_shortcode') ) {
function post_grid_shortcode( $atts ){
global $post;
if( have_rows('post_grid') ):
while( have_rows('post_grid') ): the_row();
// 2
$featured_posts = get_sub_field('ranking');
if( $featured_posts ):
$permalinkx = get_permalink( $featured_posts->ID );
$titlex = get_the_title( $featured_posts->ID );
$permalink = get_the_permalink();
$title = get_the_title();
echo '<a href="'.$permalink.'" class="11">'.$title.'</a>';
echo '<a href="'.$permalinkx.'" class="11">'.$titlex.'</a>';
endif;
//2
endwhile;
endif;
}
}
add_shortcode('post_grid', 'post_grid_shortcode');
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.