Support

Account

Home Forums ACF PRO Help request with strange behaviours

Solved

Help request with strange behaviours

  • 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

  • IF it can be usefull this is the json file of my fields

  • 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

  • IT WORKED!!!
    Thank you so much!!!

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

The topic ‘Help request with strange behaviours’ is closed to new replies.