• I tried to modify standard twenty_ten function which print post’s categories and tags. I just need to post also custom taxonomy’s category.

    function posted_in() {
    	// Retrieves tag list of current post, separated by commas.
    	$tag_list = get_the_tag_list( '', ', ' );
    	if ( $tag_list&&is_object_in_taxonomy( get_post_type(), 'custom_taxonomy' ) ) {
    		$posted_in = __( 'Posted in: %3$s </br> Tagged with: %2$s');
    	} elseif( is_object_in_taxonomy( get_post_type(), 'custom_taxonomy' ) ){
    		$posted_in = __( 'Posted in: %3$s');
    	} elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
    		$posted_in = __( 'Posted in: %1$s');
    	}else {
    		$posted_in = __( '');
    	}
    
    	printf(
    		$posted_in,
    		get_the_category_list( ', ' ),
    		$tag_list,
    		get_permalink(),
    		the_title_attribute( 'echo=0' ),
    		$custom_taxonomy,
    		get_the_category_list( ', ' )
    	);
    }
    endif;

    I don’t know why it replace category list with post URL.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘standard posted_in function with custom_taxonomy’ is closed to new replies.