Tell us what you are trying to do?
I have code based on this ticket.. https://toolset.com/forums/topic/display-field-values-from-related-grand-parent-post/#post-1782239
you will see that the code that's used there is working well when displaying value on a page..
[wpv-post-body item="@eyewear-brand-eyewear-collection.parent" view_template="brand-distributor-id-for-eyewear-collections"]
I need to display the same code but with a condition so I used a view and am trying to run the condition from a shortcode and if the condition is met then display the code
[wpv-layout-start][wpv-items-found]<!-- wpv-loop-start --><wpv-loop>[wpv-item index=other][wpv-conditional if="( '[check-user-store-value]' eq '1' )" ][wpv-post-body item="@eyewear-brand-eyewear-collection.parent" view_template="brand-distributor-id-for-eyewear-collections"][/wpv-conditional]</wpv-loop><!-- wpv-loop-end -->[/wpv-items-found][wpv-no-items-found]<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>[/wpv-no-items-found][wpv-layout-end]
the check-user-store-value shortcode is here.. it just checks if the user-store and the eyewear-store match and it's working fine..
function func_check_user_store_value()
{
global $current_user;
$eyewear_store_value = do_shortcode("[types field='eyewear-store' output='raw' item='@brand-distributor-eyewear-brand.intermediary'][/types]");
$user_store = do_shortcode("[types usermeta='user-store' output='raw' current_user='true'][/types]");
if(strpos($eyewear_store_value, $user_store) !== false)
{
return 1;
}
else
{
return 0;
}
}
add_shortcode( 'check-user-store-value', 'func_check_user_store_value' );
Even though the condition works fine and it displays the content of the template (I've tested it by using some static content), for some reason either the 'item=@eyewear-brand-eyewear-collection.parent' and the contents below from the view template don't seem to work when within the loop.
[types field="id" item="@brand-distributor-eyewear-brand.parent"][/types]
you would need to log in with credentials as an optician here versteckter Link to view the result
Please advise what am I doing wrong?
Is there any documentation that you are following?
Is there a similar example that we can see?
What is the link to your site? versteckter Link