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 .'</div>';
}
}
Related Posts:
- wp_enqueue_script adding conditional statement not working
- Check if first paragraph is an image, then show custom code right after it?
- If post author role is X
- Can a conditional statement apply to part of a slug?
- Add default content to posts in a specific category?
- is_front_page, is_page(‘slug’), is_page(id) not working
- Need help on creating If-statement for custom meta fields
- How to make gravatar.com avatars conditional?
- Loading Scripts on Specific Pages
- Condition function for is parent category?
- Conditional Statement – Best Way to Remove Nav on Contact Page
- Proper syntax for simple conditional bloginfo language
- wordpress is_page() problem
- Location-Based Content
- Personalized message for each unique password-protected page
- Conditional Shortcode image display
- Change Woocommerce order button page on particular page
- Change a url / link if a user is logged in?
- to create own conditional tags for business directory in wp
- How to use “Cases” instead of “IFs” for conditional logic
- Which is the better way to write a conditional statement? [closed]
- Nested conditionals
- Is there a way to password-protect part of a post?
- if/Else have_posts Else fails to echo message to page
- Conditonal statement for iPad
- Return function only on certain pages
- How to write this conditional statement?
- Conditional for Custom Post Types
- Date-Based Conditional Tag
- Message box when accessed from iPad
- Show this code if user has previously left a comment
- Insert a conditional in the middle of a function to give it 2 different outcomes
- How can I use ‘edit_form_after_title’ conditionally?
- Force Log in to view a page
- Conditional loading of CSS for my plugin
- Looks like this if condition is not working [closed]
- Generating images from an array of categories
- WP conditional site logo and header block
- How to know if the most recent article
- Widget logic conditional widget
- How to display image on condition that a selection has been made
- How to Conditionally Not Display a Link Based on Current URL?
- Allow users to only CREATE one single (custom) post
- If statement to check for post_content
- why is my custom loop failing?
- Conditional sidebar menu
- What is the best way to disable my WP website if the user has adblocker on? [closed]
- Enqueue Scripts / Styles when shortcode is present
- wp enqueue style on specific page templates
- Loading scripts only if a particular shortcode or widget is present
- How to conditionally enqueue a stylesheet only for a certain page(s)?
- Show/hide Widgets in Dashboard Based on Current Advanced Custom Fields Option
- How to hide and content from auto-generated excerpts?
- Alternate text if shortcode returns no data
- Conditional Ajax inclusion
- How to do conditional publishing?
- A function like is_page() but returns true if on any sub page of given page
- Check to see if specific loop has less than certain amount of posts
- functions.php conditional tag – only show in single.php?
- How to Add Javascript Only When a Function Exists?
- Get all children page ID’s including parent by title
- How to not show post_thumbnail from specific category for not logged users
- Plugin Code ONLY on Post Edit Page
- Prevent update of custom user profile meta field on the front end after 1st entry
- Creating conditional to display taxonomy term meta
- Is_front_page inside header.php is always returning true
- Condition display metabox in case the post is saved
- Conditional for a Single Post That Belongs to a Category?
- is_main_site() Always Returns True
- PHP conditional script issue
- Conditionals if tags exist?
- Dynamically output a class to an anchor tag depending on what tag is chosen
- Conditional: IF post creation date is in the first half OR last half of the year [closed]
- FacetWP – conditionally display facet labels
- Check if sidebar is rendered?
- Why might conditionals not work on a page?
- NextGEN Conditional Statement [closed]
- Where do you add code in custom fuctions so it works on a specific page?
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Multidimensional Array
- Conditional featured image with youtube thumbnail
- If user is logged in and has a role echo statement
- If custom taxonomy else conditional [closed]
- How to get type of archive whether it is post or date or category archive?
- Help with this custom field conditional if no field is set display nothing
- exclude custom post type from running a function
- Show image next to the comment author if have certain role
- How do I test whether [gallery] is empty?
- How can i conditionally load taxonomy-{taxonomy}.php template php files through functions.php
- Adding if statement
- Modify wp-login.php Labels Conditionally Based On Referring URL
- Conditional Fields depending on checkboxes
- How to display content If function exist/condition true?
- If Month=Particular month display content [closed]
- functions.php conditional output for a single plugin
- Template tag for /page/# structure
- Create citation and url in post using 3 custom fields with conditions for each field… So close!
- Loop to pull content from parent element in custom post type [duplicate]
- Weird html output of single_cat_title – is not inside of the html element?
- How can i hide a specific class when cart subtotal is above a certain amount