Support

Account

Home Forums Front-end Issues Merge an ACF URL and Text field to create a href Reply To: Merge an ACF URL and Text field to create a href

  • Hi John

    I’ve now got this to work –

    <?php
    
    $hb1 = in_category( 
               array('News','Features','Tech'), 
               $this->post->ID 
    );
    
    $hb2 = in_category( array('Research'), $this->post->ID );
    $hb3 = has_tag( 
             array( 'aged care', 'anxiety/stress', 'autism', 'cognitive', 'Dementia', "Parkinson's", 'sleep' , 'well-being' ), $this->post->ID
    );
    
    if ( $hb1 )
    {
    $link = get_field('media_outlet_url', $this->post->ID);
    $media = get_field ('media_outlet', $this->post->ID);
    $country = get_field ('country', $this->post->ID);
    $publicationdate = get_field ('publication_date', $this->post->ID);
    
    echo "<a href=$link target="_blank">$media</a>";
    echo $publicationdate;
    echo $country; 
    }
    
    else if ( $hb2 && $hb3 )
    
    {
       the_field('media_outlet',   $this->post->ID);
       the_field('published_date', $this->post->ID);
       the_field('country',        $this->post->ID);
    }
    
    ?>

    Just trying to work out how to get the link to open in a blank page.

    Best

    G