Support

Account

Forum Replies Created

  • Hi there,

    I might have a related issue. Upon activation of the latest Options add-on (with ACF v4.3.5 & WordPress v3.8.1) I get the same error:

    Strict Standards: Only variables should be passed by reference in /Users/bramwillemse/Dropbox/Sites/gsc/wp-content/plugins/acf-options-page/acf-remote-update.php on line 27

    Next to that I’m not able to register a page with this code in functions.php:

    if( function_exists('acf_add_options_sub_page') )
    {
        acf_add_options_sub_page(array(
            'title' => 'Contact',
            'parent' => 'options-general.php',
            'capability' => 'manage_options'
        ));
    }

    Also other options page functions do not have any effect. And this happens when trying to add a group to the options page:
    https://www.dropbox.com/s/i4zdz32rl9v5uk1/Screenshot%202014-04-03%2014.34.31.png

    Any help would be much appreciated!

  • Good to know what the problem is here. But I don’t understand why it suddenly started breaking my websites.

    It’s an important realization that testing every update locally and on a staging environment is really the way to go..

    Anyways, I hope v5 will come soon!

  • Your remark got me thinking though, Elliot. And now I found the simple solution: rename the post object! The solution:

    <?php // If selection is made, load selection of customers
    $customers = get_sub_field('customers-select');
    if( $customers ): ?>
    	<?php foreach( $customers as $customer): // variable must be called $post (IMPORTANT) ?>
    		
    		<?php setup_postdata($customer); ?>
    
    		<?php $post_id = $customer->ID; ?>
    	    <?php $thumbid = get_post_thumbnail_id($post_id); ?>
    	    <?php $img = wp_get_attachment_image_src( $thumbid, 'medium' ); ?>
    	    <?php $logo = $img[0]; ?>
    	    <?php $customer_url = get_field('customer-url', $post_id); ?>
    
        	<li class="l-fifth customer">
        		<a href="<?php echo $customer_url ?>" role="img" alt="<?php the_title(); ?>" style="background-image:url(<?php echo $logo ?>);"></a>
        	</li>
    
    	<?php endforeach; ?>
    	<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
    <?php endif;?>

    Thanks & sorry for the waste of time, I should’ve known since I already used this method quite a lot of times.

  • Hi Elliot,

    Thanks for your quick reply. But I’m quite sure that would’nt work.

    The thing is, all this code is loaded on a page. The customer post objects are loaded in the foreach loop created with the relationship field. So the $post->ID variable should come out of the postdata within the foreach loop. If I would place it outside, the $post->ID from the page it’s all being load on would be used instead of the customer post objects.

    The weird thing is, the customer post objects $post->ID works for the post thumbnail:

    <?php $thumbid = get_post_thumbnail_id($post->ID); ?>

    But it doesn’t work when I call the custom field by that same $post->ID in the same foreach loop.

    <?php $customer_url = 'href="' . get_field('customer-url', $post->ID) . '"'; ?>

  • I just found this post on the forum (I searched before already ๐Ÿ˜‰ ):
    http://support.advancedcustomfields.com/forums/topic/displaying-items-within-a-cpt-as-choices-in-repeater-for-another/

    It might be related to my problem. Do I understand correctly my only solution is to maybe use the ‘Dynamically populate a select fieldโ€™s choices’ solution? ๐Ÿ™

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