Hey Minesh ... thx for replying ...
OK ... so I can't just set the grid at three columns because a majority of the database entries will only have 1 of the repeating field groups ... a bunch have 3 and two of them have only 2
it seems like overkill to have 3 separate views on the page. Is it possible to use the same view multiple times on a page but have the output grid count be different each time I use it?
I guess what I am in need of help with is how can I determine the number of columns to set in the view's output grid column count to be equal to that number
so if there are 3 entries in a repeating field group then it will output three columns or if there is 1 entry then it will output 1 column.
thx
UPDATE:
ok ... so I have added the following to my functions.php file in my child theme.
(I have registered the short code and the function)
now this worked for me on a past client's website .. however ... I do not have access to that code any more and I dont' know how to access this new shortcode in a view.
now I am not sure if this will work for my CURRENT situation as i dont remember if the "GET_THE_ID() is for ... do I hard code that? or is that the ID of the post the view is inside of?
this will get me a number that I can use to determine the view output grid column setting (I assume) ... but again, can I set a different column count for the same view on the same page?
/* --------------------------------------------------------------------------------------------------------------------------------- */
// START get_repeating_field_group_count
// This function will determine the number of items in a repeating field group e.g. 'Product Colorway'
// so that different output may be generated based upon the number of itmes matched.
function get_repeating_field_group_count( $atts ) {
$a = shortcode_atts( array(
'id' => get_the_ID(),
'type' => 'three-view',
), $atts );
if ( (!empty($a['id'])) && (!empty($a['type'])) )
{
$section_ids = toolset_get_related_posts(
$a['id'],
$a['type'],
'parent',
1000,
0,
array(),
'post_id',
'child'
);
return count($section_ids);
}
}
add_shortcode( 'get_rfg_count', 'get_repeating_field_group_count' );
// STOP get_repeating_field_groups_count
/* --------------------------------------------------------------------------------------------------------------------------------- */