Closed ageekonabike closed 5 years ago
/adding custom values to conditions/
add_filter( "eleconditions_vars",function($custom_vars){
global $post;
$custom_vars['altgrid']=get_post_meta($post->ID,'display_order','true')%2;
return $custom_vars;
});
and in condition to the element you enter:
altgrid== true
and false
or
altgrid== 1
and 0
That got it. Thnx. I was close. Knew I should have slept first before tackling that post type design..
Glad that I could help. You can help others too if you rate this plugin: https://wordpress.org/support/plugin/ele-conditions/reviews/
I am attempting to create an Elementor archive loop template that alternates the output layouts. The loop is for a custom post type and a evaluates a custom field.
In Code Snippets, I've added the following filter:
add_filter("FGP_alternate_grid",function($postId){ $metaValue = get_post_meta($postId,'display_order','true'); if($metaValue % 2 == 0){ return 1; } else{ return 0; } }); In each of the two sections' conditions I've added: Odd Section Condition: FGP_alternate_grid($post_id) == 0 Even Section Condition: FGP_alternate_grid($post_id) == 1
Only the odd sections are being displayed.
I've tried: if($metaValue & 1) {... as well w/o success.
Am I just completely off track in using the plugin?
Dev Site: https://dev.ageekonabike.com/framing_porfolio/