Site logo

Archived topic

meta for cpt

3 replies · Started by Axel on November 12, 2016

Viewing posts 1–4 of 4

using a litle snipplet to show meta of cpts:

if ( ! function_exists( 'generate_post_meta' ) ) :
/**
 * Build the post meta
 *
 * @since 1.3.29
 */
add_action( 'generate_after_entry_title', 'generate_post_meta' );
function generate_post_meta()
{
	if ( 'post' == get_post_type() || 'band' == get_post_type() ) : ?>
		<div class="entry-meta">
			<?php generate_posted_on(); ?>
		</div><!-- .entry-meta -->
	<?php endif;
}
endif;

this adds the date as expected... two questions:
1. what is the way to srtrip down the date so it only shows the year?
2. how can i also add the taxonomy of the cpt with this?

thanks in advance :-)

It uses the get_the_date() function which I believe pulls the format from "Settings > General.

Not sure what you mean about adding your taxonomy?

1. ... jep. but the intention was to strip don the date only for the cpt. (normal post should keep their full date format)

2. same way as adding the 'posted_on' meta for cpt - only adding taxonomy/category for cpt to show on frontend. struggling wit this, because gp blog settings dont take effect for cpt... :-)

more clear?

This archived topic is closed to new replies.