• Resolved nicdvs

    (@nicdvs)


    Hey,

    I created an option page for my theme. I also have created a custom taxonomy named “Skills” (tag – so non-hierarchical?).

    On the options page, I would like to display an input type text for each “Skills” (tag). I tried the following code but I get an error (I don’t think I can use foreach loop inside an array..(?)).

    Any help is appreciated.

    <?php
    $themename = 'CHAMNGEME';
    $shortname = 'cm';
    
    $terms = get_terms('skills');
    
    $options = array(
    	array(	'name' => $themename.' Options',
    			'type' => 'title'),
    
    	/* Portfolio options */
    	array(	'name' => 'Portfolio',
    			'type' => 'section'),
    	array(	'type' => 'open'),
    
    	foreach($terms as $term){
    		array(	'name' => $term,
    			'desc' => 'Enter the hexadecimal color to be used for the '.$term.' skill.',
    			'id' => $shortname.'_skill_'.$term,
    			'type' => 'text',
    			'std' => '345423'),
    	}
    
    	array(	'type' => 'close')
    );

    Thanks,

    Nicolas

  • The topic ‘FOREACH LOOP IN OPTIONS PAGE’ is closed to new replies.