Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author E2Pdf

    (@oleksandrz)

    Hi,

    Do you have issues with output some information from ACF Options fields? If so, can you please give some more information or screenshots so we can see which output you get. Usually we recommend to use “textarea” field inside E2Pdf Template with mapped shortcode for test purposes.

    However currently it’s possible:

    – Use native ACF shortcodes inside E2Pdf Template as [acf field="field_name" post_id="[id]"] – [id] will always will render to Post ID for which PDF generated (if E2Pdf Template connected to “WordPress”).

    – Use meta values which used by ACF via [e2pdf-wp key="mymeta" meta="true"], but it can output array in some cases and it will require to use “path” attribute or new [e2pdf-foreach] shortcode (it’s not yet documented).

    • This reply was modified 3 years, 8 months ago by E2Pdf.
    Thread Starter jirkad

    (@jirkad)

    Hi,

    thank you for the fast response. I try describe what I want to do:

    1. I have AFC Options page “Menu” where are these ACF fields:
    1.1) Date -> return date
    1.2) Menu -> repeater:
    1.2.1) Menu Name -> return text from the repeater
    1.2.1.) Menu Price -> return price from the repeater

    What I already tried:
    PDF Options: Extension WordPress, Item: Group Fields
    Shortcodes:
    [e2pdf-wp key=”Date” meta=”true” path=”0.name”]

    I don′t know, how to get it to work with the Date field and how to get Repeater fields.
    Maybe [e2pdf-foreach] is ideal for repeater fields?

    Thanks a lot, George

    Plugin Author E2Pdf

    (@oleksandrz)

    After some investigation it looks like possible to get “options” page values globally with “ACF” native shortcodes:

    [acf field="{$field_name}" post_id="option"]

    Example: [acf field="test" post_id="option"]

    For repeater fields it’s possible to get values separately as:

    [acf field="{$repeater_field_name}_{$row}_{$sub_field_name}"]

    Example: [acf field="repeater_0_repeater1" post_id="option"]

    If you want to get all repeater values, it seems possible to prepare own shortcode as described here and use it inside E2Pdf Template: https://support.advancedcustomfields.com/forums/topic/repeater-field-shortcode/

    Thread Starter jirkad

    (@jirkad)

    Thanks a lot, it works!

    I made my own shortcode, that returns ACF repeater fields exactly what I want.

    function e2pdf_acf_repeater() {
    
       ob_start(); ?>
       <?php if( have_rows('repeater_name', 'option' ) ): ?>
    
        <table">
              
        	<?php while ( have_rows('repeater_name', 'option') ) : the_row();
        
        		// vars
                $subfieldname1 = get_sub_field('repeater_subfield');
        	    $subfieldname2 = get_sub_field('repeater_subfield');
        
        	?>
        
        	<tr>
              <td><?php echo $subfieldname1; ?></td><td><?php echo $subfieldname2; ?></td>
        	</tr>
        	
            <?php endwhile; ?>
        
        </table>
    
    <?php endif; ?>
    <?php $output = ob_get_clean();
        return $output;
    }
    add_shortcode('e2pdf_acf_repeater_shortcode', 'e2pdf_acf_repeater');

    Thank you for your help, I’ll buy a premium to support you.

    George

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘ACF Options support’ is closed to new replies.