Support

Account

Forum Replies Created

  • Maybe I’m not understanding but why wouldn’t you just make an ACF block that pulls in what you need and they in the block editor nest that block inside the Query block or Post Temolate block?

  • Ok so although it’s not in the “sizes” array you can of course still access the image size with a WordPress function. So instead of trying to get a custom image size from an option field but directly referencing the “sizes” array i.e.:

    $image['sizes']['banner']

    I’m just doing

    wp_get_attachment_image_src($image['ID'], 'banner')

    This will output an array. The first item in the array (0) with be your image URL

  • Ok it’s 2021 and I’m still seeing this issue. If I get an image field from an option fieldset with the field set to return an array the output only includes the standard WordPress Images sizes in the [‘sizes’]. All of the custom image sizes are missing from the array. The image 100% exists and was generated on upload. But I cannot access it since get_field(‘my_image’,’option’) does not have my custom image in the [‘sizes’] array. I’ve deleted. Re-uploaded. Re-generated. Nothing. Weird.

  • Same here but not on all sites, just one. Disabling all other plugins didn’t help.

  • I’m an idiot. Just up-thread on this SAME page I see that the awesome Matt Keys (I use other plugins by Matt) has created this solution!

    https://support.advancedcustomfields.com/forums/topic/conditional-logic-using-taxonomy-field/page/3/

  • Very long thread so sorry if this has already been suggested… but I was wondering about this too and my first thought was… why not use a Select field instead of a Taxonomy field (where conditional logic is already natively supported) and then use some simple PHP to populate the select field. Like this:

    // Programmically Populate an ACF Select Box
    function acf_load_type_field_choices( $field ) {
        $choices = get_terms( 'battery_type', array('hide_empty' => false) );
        if( is_array( $choices ) ) {
            foreach( $choices as $choice ) {
                $value = $choice->slug;
                $label = $choice->name;
                $field['choices'][$value] = $label;
            }
        }
        return $field;
    }
    add_filter('acf/load_field/name=type', 'acf_load_type_field_choices');
    

    This is probably not a great solution though because you have the data in two places not… the taxonomy and the select field. Just a thought. Was hoping to think of a clever solution easier than writing a bunch of JS.

  • I was seeing this issue. If I grab my repeater and output it raw it’s showing an empty array but have_rows() was returning true. I think it was just the result of my data and fields changing a number of times during development. Re-saving all the pages seemed to fix it.

  • I tried but there seems to be no way to make an ACF field group display inside a WooCommerce product data tab in admin. So I resorted to a jQuery hack. It’s “ugly” but it works. The short answer is:

    $("#source").appendTo("#destination");

    The long answer is, create a new custom product data tab as a placeholder:

    // Register New Product Data Tab
    add_filter( 'woocommerce_product_data_tabs', 'add_custom_product_data_tab' );
    function add_custom_product_data_tab( $tabs ) {
    	$tabs['my-custom-tab'] = array(
    		'label' => 'Dates & Times',
    		'target' => 'my_custom_product_data',
    	);
    	return $tabs;
    }
    
    // Create Product Data Tab Content
    add_action( 'woocommerce_product_data_panels', 'add_custom_product_data_fields' );
    function add_custom_product_data_fields() {
    	echo '<div id="my_custom_product_data" class="panel woocommerce_options_panel"></div>';
    }

    Then add some JS & CSS to admin:

    // Add JS & CSS to move and style ACF fields inside Product Data Tab
    function admin_style() {
    	wp_enqueue_script('admin-script', get_template_directory_uri() . '/js/admin.js', array( 'jquery' ) );
    	wp_enqueue_style('admin-styles', get_template_directory_uri().'/css/style-admin.css');
    }
    add_action('admin_enqueue_scripts', 'admin_style');

    My ‘admin.js’ file script looks like this:

    jQuery(document).ready(function($) {
    	$("#acf-group_5988b10b578ea").appendTo("#my_custom_product_data");
    });

    And my ‘admin-style.css’ file looks like this:

    #my_custom_product_data {
    	padding: 13px;
    }
    #my_custom_product_data .acf-label {
    	margin: 0;
    }
    #my_custom_product_data .acf-label label {
    	font-weight: 400;
    	font-size: 12px;
    }

    All this does is move the ACF field group from one div to another using jQuery and adds some CSS to iron out some ACF and WOO style conflicts (i.e. make the ACF panel look more like the WOO-native panels)

  • I was wondering the same exact thing today! I’ve been building a lot of sites in Craft CMS lately and I love the tabbed interface. I found this solution:

    https://www.advancedcustomfields.com/resources/moving-wp-elements-content-editor-within-acf-fields/

  • I bumped max_execution_time to 20 minutes. No dice. Network connection dropped… admin-ajax.php 🙁 I’ve given up on upgrading any of my MANY pre 5.x client sites. They will be stuck at 4.x forever.

  • Agreed. I’m using custom fields for taxonomy terms… so if you have a taxonomy with 250 terms and I have to cross check with wp_options for say… 2 custom fields… the number of queries goes from 1 with get_terms() to 500 when I have to loop through every one to get it’s associated custom field in wp_options. Brutal. Adds 5 seconds to page load time. There must be some better way?

  • Sorry I’m an idiot. I usually have the “Simple Page Ordering” plugin installed on all my sites… it wasn’t on this one. So it’s not an ACF issue at all. My bad.

  • Ouch. That screenshot posted in November is scary. I can’t imagine expecting a client to use that. Clever use of nesting of reporters and layouts though. My thought on this would be that maybe you could keep your fields setup as they are and use the admin_head action to inject some custom CSS into the dashboard to clean up the UI.

  • I’m guessing the plugin is abandoned? Would be great if it worked with repeaters and layouts. Oh well :/

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