Copy advanced custom field content from other page using if statement

Im trying to copy some content from another page with an if statement that has an input from advanced custom fields so I dont have to manage two pages with the same content. However the code has a bug in it which prevents the page from loading when this section starts. I guess I made a type somewhere. What could it be?

The first block contains the information from post id 4767 that i want to display on post id 4940. The second block is the information that would normally be loaded and is entered on all the individual pages.

<?php if(is_single('4940')) { 
            if( have_rows('partner', 4767) ):
                while ( have_rows('partner', 4767) ) : the_row();
                    $partnerTag      = get_sub_field('partner_tag', 4767);
                    $partnerName     = get_sub_field('partner_name', 4767);
                    $partnerImage    = get_sub_field('partner_image', 4767);
                    $partnerImageUrl = $partnerImage['sizes']['medium'];
                    $partnerLink     = get_sub_field('link', 4767); 
      } else { 
            if( have_rows('partner') ):
                while ( have_rows('partner') ) : the_row();
                    $partnerTag      = get_sub_field('partner_tag');
                    $partnerName     = get_sub_field('partner_name');
                    $partnerImage    = get_sub_field('partner_image');
                    $partnerImageUrl = $partnerImage['sizes']['medium'];
                    $partnerLink     = get_sub_field('link');
 } ?>

ps. I tried both: is_single(‘4940’) and is_single(4940)

Read more here: Copy advanced custom field content from other page using if statement

Leave a Reply

Your email address will not be published. Required fields are marked *