php - If variable equals something, make a have a href attribute -


using advanced custom fields plugin on wordpress site. have select option in 1 of custom post types determines if post going link page or call out popup.

here how looks.

<!-- here goes code defining post type. works fine --> <?php $hmltype = get_field('post_url_or_popup'); ?> <div class="tablecell midlineunit middle">         <a class="table midunithref mw1" <?php if ($hmltype == hml_url) { echo 'href="<?php the_field('hplb_url'); ?>" ' } endif; ?> > </a> </div> 

must syntax error, i'm starting out php, so, kind of difficult find mistake.

what hml_url? variable called $hml_url..? issues, you're using endif; here wrong. can ever call if instantiate this:

if(condition) :     stuff; endif; 

now fix print.

<a class="table midunithref mw1" <?php echo ($hmltype == hml_url) ? 'href="'. the_field('hplb_url'); .'"' : ''; ?> > 

you'll need figure out/tell hml_url solve issue. would've seen error if turned error reporting on. can adding top of script:

ini_set('display_errors', 1); error_reporting(-1); // or e_all 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -