Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • @bocacommunity

    Yes, you have a problem.

    1 is that the other field is not supported and 2 is that if you add a field in ACF it will not have the same field key.

    You can create a temporary function that runs and replaces the data, the problem is that it might time out. I might do something like this (back up your database first)

    
    add_action('init', 'temp_replace_data_function') {
      if (!is_admin()) {
        // only run in the admin
        return;
      }
      $args = array(
        // just a sample
        // do query to get all posts that have the old field
        'post_type' => 'post type to update',
        'posts_per_page' => -1,
        'meta_query' => array(
          array(
            // only get posts that have a value for this field
            // this way we can eliminate the ones we've already done
            // if it times out, re-running will not redo posts we've already taken care of
            'key' => 'old-field-name',
            'compare' => 'EXISTS'
          )
        ),
        // other arguments as needed
      );
      $query = new WP_Query($args);
      if ($query->have_posts()) {
        global $post;
        while ($query->have_posts()) {
          $query->the_post();
          $post_id = $post->ID;
          // get the old value
          // convert it from what the other plugin is storing to ACF format
          // update the new ACF field (use the field key, not field name)
          // sorry I can't be much more help here
          
          // **** IMPORTANT ****
          // delete the post meta for the old field name
          // see not in the meta query above
          delete_post_meta($post_id, 'old-field-name');
        }
      }
    }
    
  • So I have some difficulties with ajax. With a developper friend, we did like this and it’s working.

    So if someone have the same problem, we did it like this:

    I made a php file “parametres-template-css.php” wich calling acf fields and use:

    <?php
    if( have_rows('repeater', 'option') ):					
    	while( have_rows('repeater', 'option')): the_row(); 
    		$FieldColor = get_sub_field('color'); 			
    	endwhile; 
    endif; 

    the first problem was I used the_sub_field and not get_subfield

    I made my css-php “styles-css.php” file including “parametres-template-css.php” like this:

    <?php require( 'parametres-template-css.php'); ?>
    
    <?php /* ---------------- TITLE ----------------  */ ?>
    
    	h1{ color:  <?php echo $h1titleColor ; ?>;}

    and I included this file in my headers

    <style><?php include("inc/template/css-template/styles-css.php"); ?></style>

  • So I think I managed to fix this for me… Apparently the jQuery version & jQuery migrate was colliding with the version used when enqueueing scripts from ACF / WordPress. It gave no errors so I didn’t catch it at first. So I excluded my version of jQuery & Migrate from the specific templates and now it’s working as intended. I hope it helps!

  • I’ve looked into it again and wp_user_meta() is just a wrapper for get_metadata() which caches its results.

    I suspect you have made your user edits earlier in the exection of the request, then later in the execution you want to send this email.

    You can bust the cache by putting this at the top of your email call:

    update_meta_cache( 'user', $user_id );

    Please accept my answer on SO too 🙂

  • I have a solution for you! I used the code from the bottom of Function Reference/get pages

    and figured out by trial and error that <?php echo the_field('your_field_id', $page->ID); ?> does the trick to display field data from the child pages.

    Final code (including post thumbnail if you want):

    <?php
    	$mypages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'post_date', 'sort_order' => 'desc' ) );
    
    	foreach( $mypages as $page ) {		
    		$content = $page->post_content;
    		if ( ! $content ) // Check for empty page
    			continue;
    
    		$content = apply_filters( 'the_content', $content );
    	?>
    		<?php echo get_the_post_thumbnail($page->ID); ?>
    		<h2><a href="<?php echo get_page_link( $page->ID ); ?>"><?php echo $page->post_title; ?></a></h2>
    		<p>Custom field info: <?php echo the_field('your_field_id', $page->ID); ?> </p>
    		<div class="entry"><?php echo $content; ?></div>
    	<?php
    	}	
    ?>
  • i use checkbox :
    choices :

    <a><img src="/icon/telegram-logo.svg" /></a> : Tele
    <a><img src="/icon/telegram-logo.svg" /></a> : Facebook
    .
    .
    .
    .

  • I have added the first code snippet from this page https://www.advancedcustomfields.com/resources/relationship/:

    <?php 
    
    $posts = get_field('relationship_field_name');
    
    if( $posts ): ?>
        <ul>
        <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>
            <?php setup_postdata($post); ?>
            <li>
                <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                <span>Custom field from $post: <?php the_field('author'); ?></span>
            </li>
        <?php endforeach; ?>
        </ul>
        <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
    <?php endif; ?>

    I have added the code to content-single-product.php

    However, no links are displaying.

    Do you think it could be the $posts bit? i ask as the content type is product, it’s not a straight forward post content type.

  • @John Huebner:

    Your last suggestions don’t work for me unfortunately. I have been unable to update ACF Pro for about 3 weeks now on 2 separate multisite installations, they always produce a ‘bad request’. I have removed the update transients in both the multite sitemeta table and the options table of the primary blog to no avail.

  • As it turned out, this plugin “ACF for Woocommerce” saves the field data as meta_key: “field_5b7e4f388fd11” and meta_value: “+79998006655”. Tell me how to correctly display the fields in my code?

    get_field( 'field_5b7e4f388fd11', "user_{$user_id}" )

    This for some reason does not work. Emails come empty fields ((

  • I was running ACF PRO 5.7.0 but as an mu-plugin so it wasn’t obvious to me there was newer versions.

    Elliot replied in a ticket to me;

    In the most recent versions of ACF and ACF PRO we have moved around the order of actions allowing the “acf/load_value” action to run last (after “acf/load_value/type=repeater”).

    If you hook into the “acf/load_value” filter, you should now be able to customize the repeater field value as an array, not as a numeric number.

    So this has changed very recently. Now with version 5.7.6 you can handle it like this;

    	function my_acf_load_method($value, $post_id, $field) {
    			
    		if ($field['type'] == 'number') {
    
    			$value = 123;			
    
    			return $value;
    
    		} elseif ($field['type'] == 'repeater') {	
    		
    			$value[] = array(
    				'field_url' => 'http://www.google.com',
    				'field_text' => 'Google'
    			);
    
    			return $value;
    			
    		}	
    		
    	}
    	
    	add_filter('acf/load_value', 'my_acf_load_method', 20, 3);
    

    Checking the value of your repeater, returning $value as a string where the acf/load_value method is expecting a string, and $value as an array when it’s expecting an array.

    Much easier, thanks again Howdie_McGee.

  • Alright, I managed to solve the problem by using the native get_post_meta() function.

    The reason I needed this post request is a button in a form that prints a PDF of my custom post type. And after you press the button, a POST request is fired. Maybe there are better solutions but I sticked for it and didn’t want to change it.

    First, I found out how many subfields there are:

    $stepcount = get_post_meta($id, 'schritte')[0];

    Then, I itereated:

        for ($i = 0; $i < $stepcount; $i++) {
            echo ($i+1).". ".get_post_meta($id, 'schritte_'.$i.'_schritt_beschreibung')[0]."<br>";
        }

    The most important part is the field name (schritte) and the subfields $i__schritt_beschreibung. schritt_beschreibung is the slug of the subfield.

    I hope it helps

  • That rollback plugin is one of the options listed. If you don’t want to mess with FTP then I’d try that.

    I you download from the other URL then you’ll need to upload manually. Basically you need to connect with FTP and delete the acf folder from your plugins and then upload the older version.

    Rolling back to version 4.0

    If you’d like to go back to an earlier version of ACF, we recommend using this rollback plugin, which is available from the WordPress repository. Once installed, use the Dashboard > Plugins page to Rollback the ACF plugin.

    Alternatively, you can rollback manually by downloading an older version of ACF and uploading it to your server via your favourite FTP application. Replacing the ACF plugin folder will not affect your data in any way and is a completely safe way to rollback

  • Thanks so much John!

    I do have a dumb question…

    Do I need to do this via FTP or my File manager?
    Can I just upload the new plugin?
    (Sorry – but have not done this before!)

    I found the WP Rollback Plugin. Would this work?
    https://wordpress.org/plugins/wp-rollback/

    I found this:
    Can I roll back?
    Yes, although it is a manual process. All versions of the ACF plugin can be found here. Simply download, extract and replace your ‘plugins/advanced-custom-fields’ plugin folder

    Thanks again!

  • I have not.

    I filled out this support form:
    https://www.advancedcustomfields.com/contact/

    And got a reply back…but my questions were not fully answered, so afraid to apply the updates.

    Maybe you can reach out as well and post this thread.

    Thanks!

  • Hello – I have reached out to support and am praying all data is not lost :-).

    I filled out this support form:
    https://www.advancedcustomfields.com/contact/

    And got a reply back…but my questions were not fully answered, so afraid to apply the updates.

    If I hear back with solution I will post it here!

    You might want to reach out to support as well.
    And reference this thread.
    This thread is the ‘Community’ forum.

    Thanks for posting.
    I am certain ACF can fix this as they are top-notch!

  • Same here – WordPress 4.9.8 and ACF Pro 5.7.6. It looks as though the key (added according to the docs for acf_update_setting) isn’t being appended to the request to the Google Maps API. This has worked seamlessly for quite a while and appears to have only stopped working recently. Funnily enough, the address search function works and the value of the field is saved. It’s just that the map itself is covered by a semi-transparent dark overlay.

  • Hi, I’m having the same issue but with ‘option’. Inside functions.php I have

    if (have_rows('groups', 'option')) :
       $output .= "here";
       while (have_rows('groups', 'option')) : the_row();
           $output .= "in";
       endwhile;
    endif;

    But it nothing shows, not ever “here”. I’ve tried printing out have_rows('groups', 'option') and it shows 1.

    Is this an ACF limitation and I better find other ways to solve my problem?

  • this is the code I got working for anyone interested…

        private function display_field_selects(){
            $field_group_key = 'group_5b9b435363912';
    
            $fields = acf_get_fields($field_group_key);
            echo '<form id="category_filter">';
            foreach ($fields as $field => $data){
                echo '<div class="category_wrapper">';
                echo '<p class="field_label">'.$data['label'].'</p>';
                echo '<select id="ms_'.$data['name'].'" multiple>';
    
                foreach ($data['choices'] as $key => $value ){
                    echo '<option value="'.$value.'">'.$key.'</option>';  
                }
                echo '</select>';
                echo '</div>';
            }
            echo '</form>';
        }

    This pulls the correct field group data and creates a dropdown select for each field and its options. I believe it will work only on Radio and Checkboxes.

    The next phase for me now is to either get the field_key automatically or create a function that can retrieve the appropriate field_group_key from a predetermined list.

    Thanks John!

  • Sorry, I dare not to touch previous comment again, filter will kick in.

    This is a bit false, wrongly worded:

    – With ACF PRO deactivated CF7 works and send mails.
    – Or better to say, with CF7 JS scripts deactivated.

    – CF7 works nice with all CF7 JS scripts called on Page, without ACF PRO.

  • Adding: add_filter( ‘wpcf7_load_js’, ‘__return_false’ ); to the functions.php solves problem. But then what is the point, those are CF7 necessary scripts.

    It is worth for developers to take a look into this problem. Both plugins are installed on plenty of websites. I will repeat most important points:

    – Theme makes no problem.
    – Other plugins make no conflict (I tested with only CF7 and ACF PRO activated on Page.)
    – With ACF PRO deactivated CF7 works and send mails.
    – Or better to say, with CF7 JS scripts deactivated.

    – Uoploaded again source files of latest WP, CF7, ACF PRO.
    – wp-config.php and .htaccess files are OK.
    – No cache remains folders around.
    – mu-plugins folder clear.
    – SSL certificate, seems as, working OK.
    – Definitely not problem with mod_security or server firewall (or ?)

    I do not know what plugin is a bit away from WP coding practices. But the fact is ACF PRO is influencing CF7 form functionality, not the other way around. CF7 makes no problems for ACF PRO. Not visible anyway.

    Here is more from console:

    VM1350:1 POST https://www.some-site.org/wp-json/contact-form-7/v1/contact-forms/2584/feedback 403 (Forbidden)
    (anonymous) @ VM1350:1
    send @ jquery.js:4
    ajax @ jquery.js:4
    wpcf7.submit @ scripts.js:348
    (anonymous) @ scripts.js:56
    dispatch @ jquery.js:3
    r.handle @ jquery.js:3

    Hitting antispam filter on forum. Just to ad one more sentence to try again.

  • Hi John,

    I already use the ACF documentation, and the forum thread you listed is useful but I read your advice and I’ll change my way to do 🙂

    Yes I need the repeater field because I used it 99% for only store complexe and related datas which are not used in query but fill by several staff members (and it’s very userfriendly). For the last 1% I’ll look for a simple solution based on your advices.

    Thanks !

  • Thank you so much for your quick reply and clear advice John, it is much appreciated.

    The priority was the key here. I tried acf/save_post at priority 20 (and higher) as you suggested, but it still didn’t work. But the doc you linked to mentioned using save_post in some circumstances so I tried using just save_post at priority 30 and that works perfectly.

    Thank you again!

Viewing 25 results - 9,176 through 9,200 (of 21,339 total)