Home Forums Front-end Issues ACF repeater values and domPDF


ACF repeater values and domPDF

  • I am using domPDF to generate PDFs on certain pages of my site

    The problem I am having is that it won’t allow me to use repeater values (via any sort of loop), it doesn’t seem to want to generate them when the PDF is created.

    If I call the repeater field itself as a variable, it returns ‘array’, so I assume it’s possible to get it working, somehow.

    It appears the repeaters first need to be generated and then included (perhaps as a variable?), but I’m unsure of how to do this.

    Does anyone have any idea of how I can get this to work?


  • This is the code I’ve tried using:

    At this point I’d be willing to pay $50 for the correct answer (assuming it’s easy enough). I just need a way of displaying those repeater fields in a list in the PDF.

    If it can all be created before the PDF code is generated, then stored as a variable somehow, I can include the variable in the PDF code and it should work.

  • Nevermind, this was how:

    			if( have_rows('team_contact_details')) :
    				while(have_rows('team_contact_details')) : the_row();
    					$content .= '<h3>'. get_sub_field('contact_label') .'</h3>';
    					if(get_sub_field('contact_link') == 'phone') {
    						$content .= '<div>'. get_sub_field('phone_number') .'</div>';
    					} else {
    						$content .= '<div>'. get_sub_field('email_address') .'</div>';
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.