• Resolved IntMilkBrilliant

    (@intmilkbrilliant)


    Fellow WordPressers,

    I’m currently trying to iron out a few issues in my website at present. I’m using posts for the blog section of the site, CPT’s for the portfolio section and pages for the rest.

    Using tinymce, I’m trying to call the data inputted into the CPT’s in a select box. As with many themes, the idea is to get a portfolio of images on our ‘products’ page with ‘further reading’ links back to the CPT’s.

    The code I have shows spaces for three categories, which I’ve previously made in the CPT, with a hyphen in place of the category itself.

    <td nowrap="nowrap"><label for="category">Select category</label></td>
                <td><select id="category" name="category" style="width: 200px">
                    <option value="0">No Category</option>
    				<?php
    				/* Get Taxonomies into a drop-down list */
                                    $category = get_terms('category', 'hide_empty=0');
                                           foreach($categories as $category) {
                                           $categories[$category->term_id] = $category->term_name;
    				}
    					if(is_array($category)) {
    						foreach($category as $category_termid => $category_termname) {
    							if ($category_termname !='') {
    
    				 echo '<option value="' . $term_id . '" >' . $term_id . ' - ' . $term->name . '</option>' . "\n";
                                       }
                                   }
    			} ?>

    Any ideas on how I can populate the tinymce dropdown list with the correct categories?

    Appreciation in advance

  • The topic ‘listing taxonomies in tinymce’ is closed to new replies.