Understanding How to Retrieve Taxonomy Advanced

Support General Understanding How to Retrieve Taxonomy Advanced

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6518
    LockeLocke
    Participant

    I'm trying to retrieve the TaxonomyAdvanced from MB Settings Page, but I don't understand why I'm getting Null:

    
    $meta_boxes[] = array(
    		'id'             => 'activate_c',
    		'title'          => __( 'Active c', 'textdomain' ),
    		'settings_pages' => $prefix .'c_settings',
    		'context' => 'advanced',
    		'priority' => 'high',
    		'autosave' => true,
    
    		'fields'         => array(
    			array(
    				'name'    => esc_html__( 'Activete C', 'textdomain' ),
    				'id'      => 'cc_activate',
    				'type'     => 'checkbox',
    
    			),
    			array(
    				'name'    => esc_html__( 'CC', 'textdomain' ),
    				'id'      => $prefix . 'cc_date',
    				'type'    => 'datetime',
    				'timestamp' => true,
    				'visible' => ['cc_activate', true] // Visible if checkbox_field is checked
    
    			),
    			array(
    				'name'    => esc_html__( 'CC Select', 'textdomain' ),
    				'id'      => $prefix .'cc_connect',
    				'type'    => 'taxonomy_advanced',
    				'taxonomy'   => 'brand',
    				'field_type' => 'select_advanced',
    				'visible' => ['cc_activate', true]
    
    			),
    		),
    	);
    

    And I'm trying torequest this info as a test:

    
    if (!function_exists('cc_slug')):
        function cc_slug()
        {
        	global $prefix;
    	    $terms = rwmb_meta( $prefix . 'cc_connect' );
    	    $content = '';
    	    if ( !empty( $terms ) ) {
    		    $content .= '<ul>';
    		    foreach ( $terms as $term ) {
    			    $content .= sprintf(
    				    '<li><a title="%s" href="%s">%s</a></li>',
    				    esc_attr( $term->name ),
    				    esc_url( get_term_link( $term, 'tax_slug' ) ),
    				    esc_html( $term->name )
    			    );
    		    }
    	    }
    	    echo $content;
        }
    endif;
    

    I get in var_dump(cc_slug()); NULL

    So I really do not understand how exactly Taxonomy Advanced work.

    thank you

    #6519
    LockeLocke
    Participant

    Ok Forget the last post , I just notice that I have to define the Settings Page . And that is amazing (You have to read more !! , lol)

    Now that I solve this and I don't want to waste this Thread, how can I get ISO time from date metabox???

    Thank you

    #6533
    Truong GiangTruong Giang
    Participant

    Hi there,

    To get ISO date from date string, you can use this PHP function: http://php.net/manual/en/function.date-create-from-format.php

    Thank you.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Understanding How to Retrieve Taxonomy Advanced’ is closed to new replies.