Home › Forums › General Issues › Links do not appear as links
Hello
when entering a link into a textarea or wysiwyg field it does not appear as link on the website.
I must be missing something.
Any ideas?
Thanks
Hi @mmjaeger
ACF does not have an auto link generator built in.
Perhaps you are expecting functionality that does not exist.
You can use the link button in your WYSIWYG field to create links on text
Also, your topic title is very missleading to other readers. WOuldn’t it be better written as:
‘Links in text field are not automatically converted to tags. Is this a bug, or do I need to write some code?’
Thanks for replying Elliot – actually this is not about converting links to tags – this is about entering plain html code incl. a tags like <a href=…. that do not appear as links in the front-end also I’ve entered the html code properly?
something weird is going on here:
//$teaser_content = get_post_meta( $id, 'fld_teaser_content', true );
$teaser_content = get_field( 'fld_teaser_content', $id, true );
the first disabled line of code actually returns the content of the field – however links are not showing as links
the second line of code doesn’t return the field content
Hope you got an idea?
What am I missing
Hi @mmjaeger
What is the 3rd parameter in the get_field function?
Can you confirm that the field_name is correct?
Can you confirm that $id is correct? Is this even needed?
I thought the third paramenter in get_field is for the format – nevertheless, plain get_field(‘fld_teaser_content’) doesn’t return anything either whereas get_post_meta always returns the correct value?
this is the whole function – hope it helps:
add_filter( 'genesis_before_entry_content', 'custom_entry_content' );
function custom_entry_content() {
if ( !is_single() )
return;
$id = get_the_ID();
if ( empty($id) )
return;
$teaser_content = get_post_meta( $id, 'fld_teaser_content', true );
//$teaser_content = get_field( 'fld_teaser_content', $id, true );
if ( empty( $teaser_content ) )
return;
$html = "\n\t" . '<div class="teaser-box neutral-box">';
$html .= "\n\t\t" . '<div class="teaser-header"><h6><i class="icon-pushpin pull-right"></i>Hinweis</h6></div>';
$html .= "\n\t\t" . '<div class="teaser-content">' . sanitize_text_field( $teaser_content ) . '</div>';
$html .= "\n\t\t" . '<div class="teaser-footer">Bitte <a href="?page_id=38" title="Kontakt">kontaktieren</a> Sie uns für ein unverbindliches Gespräch.</div>';
$html .= "\n\t" .'</div>';
echo $html;
}
Hi @mmjaeger
$teaser_content = get_field( 'fld_teaser_content', $id );
Should work. Can you confirm that $id is correct?
Hi @mmjaeger
Sorry, but I am not able to access and write code for your site.
There are plenty of code examples and 100,000s of success stories using ACF.
I don’t understand why you can’t get this simple get_field to work, but perhaps some debugging / investigating is needed.
Good luck
Thanks
E
The topic ‘Links do not appear as links’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.