Support

Account

Forum Replies Created

  • In the meanwhile, I will try to dynamically populate the fields choices array and see if that works.

    While this didn’t solve my original problem of the choices/pages not showing up in a ‘Relationship’ type field, the alternative approach described above worked just fine for what I was trying to achieve:

    
        acf_render_field_setting( $field, array(
    		'label'			=> __('Hide on Pages', 'jdmn'),
    		'instructions'	=> __('Hide this field on the following pages.', 'jdmn'),
    		'name'			=> 'hide_on_pages',
    		'type'          => 'select',
            'choices'       => (function(){
                $array = array();
                $pages = get_pages();
                foreach( $pages as $page ) {
                    $array[$page->ID] = $page->post_title;
                }
                return $array;
            })(),
            'default_value' => null,
            'allow_null'    => 1,
            'multiple'      => 1,
            'ui'            => 1,
    	), true);  
    
  • Thanks for clearing that up. In the meanwhile, I managed to achieve the visual result I was aiming for using the CSS column-count and column-span properties.

  • I was facing the same issue and came up with this more robust CSS-based solution which targets the relevant CSS class and will work across possible translations of the “No image selected”-string.

    
    .hide-if-value :not(a) {
        font-size: 0px;
        color: transparent;
    }
    

    This selector can optionally be prepended with the .acf-image-uploader or .acf-file-uploader selector in case you want to target these fields specifically.

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