Skip to content

Instantly share code, notes, and snippets.

@vanaf1979
Last active October 8, 2019 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanaf1979/dde3f724b78a060c8886666bfbfa2cf0 to your computer and use it in GitHub Desktop.
Save vanaf1979/dde3f724b78a060c8886666bfbfa2cf0 to your computer and use it in GitHub Desktop.
Gist for my article Building a Gutenberg sidebar plugin Part 5: Outputting data https://vanaf1979.nl/building-a-gutenberg-sidebar-plugin-part-5-outputting-data/
<?php
public function add_metatags_to_head() : void {
global $post;
foreach( $this->metafields as $key => $value ) {
if ( $key == 'title' ) {
continue;
}
$value = \trim( \get_post_meta( $post->ID , $value , true ) );
echo "\t<meta name=\"{$key}\" content=\"{$value}\" />\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment