Home Forums Front-end Issues ACF Auto hyper link for specific Textarea field type


ACF Auto hyper link for specific Textarea field type

  • I added this below code in theme functions

    add_filter( 'the_content', 'make_clickable', 12 );

    This made all text url within “the_content” auto hyperlink. But not one of my advanced custom field.

    Again, I tried this for my custom field by adding it in theme functions and using acf filter

    add_filter('load_field/name=downloadable_links', 'my_acf_load_field', 'make_clickable', 12);

    But this just made my custom field url contents invisible and not hyperlink.

    This is my custom field downloadable_links . Field type: Textarea. I am also using repeater with this.
    I have several links within each of this field and I want them all to be auto hyperlink without making it manually each time.

    This is my custom field front-end output code.

    <div><?php echo do_shortcode("[acf field='file_sharing_name']"); ?><? $folios = get_field('game_download'); if($folios){foreach( $folios as $f ){?><div class="wrap"><div class="file-zone-title"><? if($f){ ?><span><?= $f['file_sharing_name']?></span><? } ?></div><div class="file-download-links"><?= $f['downloadable_links']?></div><div class="clear"></div></div><?}} ?><div class="clear"></div></div>

    Would be very kind if someone can suggest me how I can make it work. As I am unable to make it work with above information. Thanks in advance.

  • Seems as there is no easy way.

    <div><?php echo make_clickable(do_shortcode("[acf field='file_sharing_name']")); ?>

    <a href="<?php echo do_shortcode("[acf field='file_sharing_name']"); ?>"><?php echo do_shortcode("[acf field='file_sharing_name']"); ?></a>

    Dont know it if works, cannot test now with your shortcode output.
    Works with standard output.

    I know topic is old, but if it can help others.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘ACF Auto hyper link for specific Textarea field type’ is closed to new replies.