Archive for: April, 2012

Breadcrumbs for Taxonomy for a Custom Post type

Apr 30 2012 Published by under PHP, Wordpress

This is what I came up with to display the category, or rather a custom taxonomy, of a single posttype page of use in a breadcrumb. The taxonomy I used is ‘smg-logo-brand’ and the terms slug where ‘kcrg’, ‘the-gazette’ and ‘sourcemedia.’ I compared the terms associated with the post to that in the URL to determine which term belonged in the breadcrumb.

if (!is_tax() && get_post_type() == 'smg-logo' && has_term( array( 'kcrg', 'the-gazette', 'sourcemedia', 'other' ), 'smg-logo-brand' ) ) {
			$terms = get_the_terms( get_the_ID(), 'smg-logo-brand' );
			foreach ( $terms as $term ) {
				if ( strpos( $_SERVER["REQUEST_URI"], $term->slug ) !== false) {
					$breads['terms'] = '<a href="/logos/'. $term->slug . '/">' . $term->name . '</a>';
				}
			}
		}

No responses yet

Custom post type capabilities

Apr 27 2012 Published by under Wordpress

$custom_posts_caps = array('edit_custom_post',
'read_custom_post',
'delete_custom_post',
'edit_custom_posts',
'edit_others_custom_posts',
'publish_custom_posts',
'read_private_custom_posts');

_smg_add_cap('administrator', $custom_posts_caps);
_smg_add_cap('editor', $custom_posts_caps);

'capabilities' => array(
'edit_post' => 'edit_custom_post',
'read_post' => 'read_custom_post',
'delete_post' => 'delete_custom_post',
'edit_posts' => 'edit_custom_posts',
'edit_others_posts' => 'edit_others_custom_posts',
'publish_posts' => 'publish_custom_posts',
'read_private_posts' => 'read_private_custom_posts'
),

No responses yet