Answer the question
In order to leave comments, you need to log in
Doesn't display custom Advanced Custom Fields?
Guys! I've been fighting for a day now, I've tried all the probably possible Wordpress plugins for displaying custom fields and none of them outputs. Also read the ACF plugin documentation (what I could) and the answers on this site. I can't figure out what the problem is.
I took the code from the plugin documentation:
<?php
$link = get_field('ssylka');
if( $link ): ?>
<a class="button" href="<?php echo esc_url( $link ); ?>">Скачать</a>
<?php endif; ?>
Answer the question
In order to leave comments, you need to log in
So get_field is displayed not within the framework of some post. WordPress doesn't understand which post you want to get extra data from. fields.
There are two options:
1. Pass the post ID to the function, for example: get_field('ssylka', $post_id);
2. Use setup_postdata(). More details: https://wp-kama.ru/function/setup_postdata
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question