<?php
//----------------------------------------------
//----------register and label gallery post type
//----------------------------------------------
$gallery_labels = array(
\'name\' => _x(\'Gallery\', \'post type general name\'),
\'singular_name\' => _x(\'Gallery\', \'post type singular name\'),
\'add_new\' => _x(\'Add New\', \'gallery\'),
\'add_new_item\' => __("Add New Gallery"),
\'edit_item\' => __("Edit Gallery"),
\'new_item\' => __("New Gallery"),
\'view_item\' => __("View Gallery"),
\'search_items\' => __("Search Gallery"),
\'not_found\' => __(\'No galleries found\'),
\'not_found_in_trash\' => __(\'No galleries found in Trash\'),
\'parent_item_colon\' => \'\'
);
$gallery_args = array(
\'labels\' => $gallery_labels,
\'public\' => true,
\'publicly_queryable\' => true,
\'show_ui\' => true,
\'query_var\' => true,
\'rewrite\' => true,
\'hierarchical\' => true,
\'menu_position\' => null,
\'capability_type\' => \'post\',
\'supports\' => array(\'title\', \'excerpt\', \'editor\', \'thumbnail\'),
\'menu_icon\' => \'dashicons-vault\' //16x16 png if you want an icon
);
register_post_type(\'gallery\', $gallery_args);
//----------------------------------------------
//------------------------create custom taxonomy
//----------------------------------------------
add_action( \'init\', \'jss_create_gallery_taxonomies\', 0);
function jss_create_gallery_taxonomies(){
register_taxonomy(
\'phototype\', \'gallery\',
array(
\'hierarchical\'=> true,
\'label\' => \'Photo Types\',
\'singular_label\' => \'Photo Type\',
\'rewrite\' => true
)
);
}
?>
/***************************************************************/
<ul class="photo-gallery-page">
<?php
$args = array(
\'post_type\' => \'gallery\',
\'taxonomy\' => \'phototype\',
\'orderby\' => \'name\',
\'order\' => \'ASC\'
);
$cats = get_categories($args);
foreach($cats as $cat) {
?>
<li class="stack twisted col-lg-3 col-md-3 col-sm-3 col-xs-12 gal_pad" >
<div id="gallery_image">
<a href="<?php echo get_category_link( $cat->term_id ) ?>">
<?php echo $cat->name; ?>
</a>
</div>
</li>
<?php
wp_reset_postdata(); }
?>
</ul>