title: Wordpress php else if statement with advanced custom fields
body: <p>I'm trying to make an <code>if-else-statement</code> which works by going if there is a link print it around the name.</p>
  
  <p>I have the below code which is almost there. However, the link is being printed above the text ranther than being an actual link. </p>
  
  <pre><code>&lt;?php if( the_sub_field('corporate_link') ){ ?&gt;
  
  &lt;a href="&lt;?php the_sub_field('corporate_link'); ?&gt;" 
     target="_blank" 
     title="&lt;?php the_field('corporate_name'); ?&gt;"&gt;&lt;?php the_field('corporate_name'); ?&gt;&lt;/a&gt;
  
  &lt;?php } else { ?&gt;
  
  &lt;?php the_sub_field('corporate_name'); ?&gt;
  
  &lt;?php } ?&gt;
  </code></pre>
  
  <p>Any thoughts on how to make it link instead of printing the link if it`s there?</p>
  
  <p>So what im looking to acheive is if there is a link print this </p>
  
  <pre><code> &lt;a href="&lt;?php the_sub_field('corporate_link'); ?&gt;"&gt;Coprate Name&lt;/a&gt;
  </code></pre>
  
  <p>If there isn't a link it just shows the corporate name.</p>