Add Your Own Meta

This is a Developer Level doc.

If you're unfamiliar with PHP and/or editing files, codes and templates, as well as with resolving possible conflict, please seek help from a professional. Under our Support Policy, we don't provide support for modifications and customization.

Default single blog post meta tags include: author, published date, category and comments. You can add your own meta tags using the following PHP snippet:

 * Add your own meta
 * By default, this new meta will be disabled, so you need to enable it in the customizer.
function my_blog_meta_choices( $return ) {

	// Add your meta name
	$return['my-meta'] = esc_html__( 'My Meta', 'oceanwp' );

	// Return
	return $return;

add_filter( 'ocean_blog_meta_choices', 'my_blog_meta_choices' );

If you want to add this new meta in your single posts, follow these steps:

Create a partials folder in your child theme, in this folder, create another one named single.
Copy the meta.php file from oceanwp/partials/single/ in the same folder of the child theme.
Open this file in your text editor and add the following code into the foreach:
<?php if ( 'my-meta' == $section ) { ?>
	<li class="meta-my-meta"><i class="icon-layers"></i><?php esc_html_e( 'My Meta', 'oceanwp' ); ?></li>
<?php } ?>

All PHP snippets should be added via a child theme's functions.php file.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.