Support

Account

Home Forums Front-end Issues display

Solved

display

  • Hi,

    how do i display the ID of a subfield:

    WP_Post Object
    (
        [ID] => 13
    <?php if( have_rows('produkt_kontaktformular') ):
    	while( have_rows('produkt_kontaktformular') ): the_row();
    		$subfield1 = get_sub_field("produkt_kontaktformular_wahl");
    
    		echo "<pre>";
    		print_r( $subfield1 );
    		echo "</pre>";
    						?>

    This code is not working:
    <?php $shortcodetodo = '[contact-form-7 id="' . $subfield1['ID'] . '" title="' . $subfield1['post_title'] . '"]'; ?>

    Happy for any suggestion!

    Thank you

  • i found a way:

    $subfield2 = get_sub_field("produkt_kontaktformular_wahl");
    $subfield1 = get_object_vars($subfield2);
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘display’ is closed to new replies.