How to call categories of custom post types?
-
I have the code below in the admin area of my template.
I would like to add to the list of categories (which the user can select in the code below) any/all “categories” for custom post types.
Is there a way to do that? If so, how?
<div style="margin: 13px 0 11px 4px; display: none;" class="et_pt_gallery et_pt_portfolio"> <h4><?php esc_html_e( 'Select gallery categories:', $themename ); ?></h4> <?php $cats_array = get_categories('hide_empty=0'); $site_cats = array(); foreach ($cats_array as $categs) { $checked = ''; if (!empty($et_ptemplate_gallerycats)) { if (in_array($categs->cat_ID, $et_ptemplate_gallerycats)) $checked = "checked=\"checked\""; } ?> <label style="padding-bottom: 5px; display: block;" for="<?php echo 'et_ptemplate_gallerycats-',$categs->cat_ID; ?>"> <input type="checkbox" name="et_ptemplate_gallerycats[]" id="<?php echo esc_attr( 'et_ptemplate_gallerycats-' . $categs->cat_ID ); ?>" value="<?php echo esc_attr( $categs->cat_ID ); ?>" <?php echo $checked; ?> /> <?php echo esc_html( $categs->cat_name ); ?> </label> <?php } ?> </div>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to call categories of custom post types?’ is closed to new replies.