A
A
Alisa712021-07-28 15:10:45
WordPress
Alisa71, 2021-07-28 15:10:45

How to display a link with social icons through acf?

There is such a block with icons. I want to make this block through acf. Here is the code

<div class="d-flex icons">
        <p>
            <a href="<?php the_field('social'); ?>"><i class="fab fa-instagram"></i></a>
        </p>
        <p><a href="#"><i class="fab fa-google-plus-g"></i></a></p>    
    </div>

But when I click on the icon, the page does not follow the link, as if the link is not inside <a>. What am I doing wrong ? Tell me please.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Daria Motorina, 2021-07-28
@glaphire

You need to debug if there is a value bound to social. You can do var_dump(the_field('social')); to see if that value exists at all. You can check how this field is stored in the database. The documentation https://www.advancedcustomfields.com/resources/get... says that without other arguments, this function displays data for the current post, are you sure you correctly bound the field to the post?)

A
Artem Zolin, 2021-07-29
@artzolin

1. Read the function documentation the_field()
2. Find out what your variable isvar_dump( get_field('social') );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question