Created
March 27, 2020 11:46
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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