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

    Thanks for getting back to me. I have tried to implement your suggestion but seem to be missing something – I am newish to php so my skills are improving daily but clearly not good enough to identify the problem.

    I implemented this off the back of your suggestion –

    <?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
    );
    
    $link = get_field('media_outlet_url', $this->post->ID);
    
    if ( $hb1 )
    {
     ?>
        <a href="<php echo $link; ?>" target="_blank"><?php the_field('media_outlet',$this->post->ID); ?</a>
       
    <?php
    
       the_field('published_date',   $this->post->ID);
       the_field('country',   $this->post->ID);
    }
    
    else if ( $hb2 && $hb3 )
    
    {
       the_field('media_outlet',   $this->post->ID);
       the_field('published_date', $this->post->ID);
       the_field('country',   $this->post->ID);
      
    }
    ?>

    But get an error.

    Any help appreciated.

    Thanks.

    Best

    G