Skip to content

Instantly share code, notes, and snippets.

@shubhw12
Created March 27, 2020 11:46
Show Gist options
  • Save shubhw12/7856b0f0a41037725acedc6cf04f2eb7 to your computer and use it in GitHub Desktop.
Save shubhw12/7856b0f0a41037725acedc6cf04f2eb7 to your computer and use it in GitHub Desktop.
Display post meta for custom post type in astra on single post page
add_action('astra_single_post_title_after', 'callback_function');
function callback_function(){
if ( 'post' !== get_post_type() ){
$enable_meta = apply_filters( 'astra_blog_post_meta_enabled', '__return_true' );
$post_meta = astra_get_option( 'blog-meta' );
if ( is_array( $post_meta ) && $enable_meta ) {
$output_str = astra_get_post_meta( $post_meta );
if ( ! empty( $output_str ) ) {
echo apply_filters( 'astra_blog_post_meta', '<div class="entry-meta">' . $output_str . '</div>', $output_str ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment