Support

Account

Home Forums General Issues show radio button choice

Solved

show radio button choice

  • Hi,
    I’ve created a radio button field with name “freeono” and key “field_5649f45ea9598”.
    I set condition in “show this group if term of taxonomy is = “formazione”, and in edit taxonomy admin page I select a choice but I can’t show it…
    This is code in my custom page

    
    <?php
    $customPostTaxonomies = get_object_taxonomies('formazione');
    
    if(count($customPostTaxonomies) > 0)
    {
         foreach($customPostTaxonomies as $tax)
         {
    	    $args = array(
             	  'orderby' => 'name',
    	          'show_count' => 0,
            	  'pad_counts' => 0,
    	          'hierarchical' => 1,
            	  'taxonomy' => $tax,
            	  'title_li' => ''
            	);
    
    		$categories = get_categories( $args );
    		
    		foreach ( $categories as $category ) { 
    			$url = get_term_link($category);?>
    			
    			<?php echo $category->name; ?><br />
    
    			<?php 
                            $field_key = "field_5649f45ea9598";
                            $field = get_field_object($field_key);
                            if ( $field ):
                               echo $field['label'] . ': ' . $field['value'];
                            endif;
                    }
         }
    }
    ?>
    

    sorry for my english 🙁

  • Hi @donnafefe

    That’s because whenever you try to fetch something from content that’s not a post type you need to specify the second parameter. For taxonomy terms that would be like taxonomyslug_termid.

    
    get_field_object($fieldkey, $category->taxonomy . '_' . $category->term_id);
    
  • No problem!

    Good luck with your coding 🙂

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

The topic ‘show radio button choice’ is closed to new replies.