Support

Account

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');