How to tie two conditions to one statement

You can do this: $ac_inc = get_the_author_meta( ‘ac_inc’, $post->post_author ); if (has_tag(‘aria condizionata’, $post) && !empty($ac_inc)) { $ac_inc=”<div class=”ac_inc”>”. $ac_inc .'</div>’; } But actually the double “if” statement would be more optimal, as you would only run ‘get_the_author_meta’ when needed: if (has_tag(‘aria condizionata’, $post)) { $ac_inc = get_the_author_meta( ‘ac_inc’, $post->post_author ); if(!empty($ac_inc)){ $ac_inc=”<div class=”ac_inc”>”. $ac_inc … Read more

How to conditionally display an ACF custom textarea contents only to those users chosen from an ACF User field

I’m quite new to this so I might be the wrong person to answer your question but: get_field(‘allowed_users’) Returns an array of user IDs so you can’t directly use in_array() So if you change the if statement to: if (is_array($allowed_users) && in_array($current_user_id, $allowed_users)) Hopefully it will work.

How to set up a echo? [closed]

You can use get_post_type() function and pass current post id to it. global $post; if(get_post_type($post->ID) == ‘videos’) { // do this } Update <?php global $post; if(get_post_type($post->ID) == ‘videos’) { ?> <video class=”video” width=”https://wordpress.stackexchange.com/questions/91208/<?php echo get_field(“width’); ?>” height=”https://wordpress.stackexchange.com/questions/91208/<?php echo get_field(“height’); ?>” controls preload> <source src=”https://wordpress.stackexchange.com/questions/91208/<?php echo get_field(“mp4′); ?>” media=”only screen and (min-device-width: 960px)”></source> <source src=”https://wordpress.stackexchange.com/questions/91208/<?php … Read more