Support

Account

Forum Replies Created

  • I just transitioned a large site that had been using WP Types to ACF.

    It was easier than I expected.

    1. export the Types data. It’s an xml file. I converted it to json (using this http://www.utilities-online.info/xmltojson/) for readability.
    2. review the fields created with Types. All Types fields are prepended “wpcf-” in the database. So, say you had an image field named “portrait”, simply recreate it in ACF with this name: “wpcf-portrait”.
    3. Carefully recreate all group fields, always keeping the same wpcf-name. all the info you need (description, field type, etc…) is in the xml/json file.
    4. Modify your theme templates. Wherever you find the function type_render_field(‘portrait’), you need to replace it with the_field(‘wpcf-portrait’) or get_field(‘wpcf-portrait’).

    It took me about two hours but it was worthy: ACF is so much better and so much more stable. Can’t count the number of times Toolset introduced bugs with its plugin updates.

    Anyways, hope this helps.

  • I should have turned my fingers seven times on my keyboard before suggesting this: a google search pointed me to an available plugin: https://github.com/tmconnect/ACF-Column-Field

    I leave this here for anyone looking for building column-based layouts.

  • Actually found a solution, using the save_post filter.

    
    
    // SYNC USER META DATA
    add_filter('acf/save_post', 'acf_set_user_meta_description', 20, 1);
    
    // FUNCTIONS
    function acf_set_user_meta_description( $user_id ){
    
    	// Keep User meta 'description' in sync with our ACF field
    	$bio = get_field('user_bio', $user_id);
    	
    	// $user_id is actually user_{id}. To update WP, we remove the "user_" part.
    	$user_id = (int)substr(strrchr($user_id, "_"), 1);
    	
    	if(!empty($user_id)){
    	// Will return false if the previous value is the same as $new_value.
    		$updated = update_user_meta( $user_id, 'description', $bio );
    	}
    }
  • found the solution: simply needed to remove the double quotes around the value

    
    	// The product's related artist.
    	$artist = get_field('artist_id');
    
    	// The product's most recent related project. If found, get the content of its "Artist" block.
    
    	$project = new WP_Query( array(
    			'post_type' => 'project',
    			'posts_per_page' => 1,
    			'orderby'=> 'date',
    			'order' => 'DESC',
    			'meta_query' => array(
    				array(
    					'key' => 'artist', // name of custom field
    					'value' => $artist->term_id,
    					'compare' => 'LIKE'
    				)
    			)
    		));
Viewing 4 posts - 1 through 4 (of 4 total)