Hi there,
back here once again after a topic resolved thanks to some users.
First of all i have to say that i’m not really into developing WP php, i’m more a graphic designer but with some basic skills in php.
This is my first experience with AFC, that i found great and fundamental for the work i’m developing: i have to write and show many custom fields to the post of a website.
I have 14 custom fields full of data, but my problem is that some of them shows correctly and other not.
The code i wrote is the same for all, so i really can’t understand what’s going on.
Maybe i did something wrong, as i told you before i’m not a programmer.
I’ve used both code to display fields, just to see in soemthing changes.
get_post_meta(get_the_id(), 'formazione', true);
and
get_field('studi');
I attach here the php files from the theme of my WP site i’ve modified, if someone can please help i’d be much appreciated.
Strange behaviour are:
– seems to work with post already created but not with new ones
– same code for showing the fields, but in some post someone shows and some not
– the code
if( !empty($pf_studi) ){
echo '<div class="one_third">';
echo '<h4>Studi</h4>';
echo '<div class="description">';
echo get_field('studi');
echo '</div>';
echo '</div>';
}
should shows only fields with some datas, but in some posts shows also empty fields.
Really don’t know if it’s something about AFC or maybe wrong code written by me
Browsing forum and Afc features i was asking to myself, maybe the best way to reach my goal is not the way i followed since now…
Maybe the fields repeater could do this job better than the way i did?!?
Open to any advice and help
NO way to get custom fields showed for new post!!
Please help!!!
I’m not sure what $pf_studi
is in reference to but in scheda.php your PHP should look like
if( get_field('studi') ){
echo '<div class="one_third">';
echo '<h4>Studi</h4>';
echo '<div class="description">';
echo get_field('studi');
echo '</div>';
echo '</div>';
}
If you mean that only that One has difference code from the other, is just a tentative i did to see if there was the problem, but It wasn’t
The topic ‘Help request with strange behaviours’ 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.