-
Notifications
You must be signed in to change notification settings - Fork 2
Add OpenGraph tags and twitter meta tags for having cards when sharing in social media #7
base: master
Are you sure you want to change the base?
Conversation
header.php
Outdated
| <?php if ( is_single() ) { | ||
| echo '<meta property="og:image" content="' . the_post_thumbnail( 'large' ) . '"/>'; | ||
| echo '<meta property="og:description" content="' . bloginfo( 'description' ) . '"/>'; | ||
| echo '<meta property="og:title" content="' . single_post_title() . '"/>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably these three values need escaping?
Also, single_post_title() echoes by default instead of returning, which means it will echo it before the current line (if understand correctly).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done and done
header.php
Outdated
| <link rel="pingback" href="<?php echo esc_attr( get_bloginfo( 'pingback_url' ) ); ?>" /> | ||
| <?php if ( is_single() ) { | ||
| echo '<meta property="og:image" content="' . the_post_thumbnail( 'large' ) . '"/>'; | ||
| echo '<meta property="og:description" content="' . bloginfo( 'description' ) . '"/>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bloginfo() echoes, use get_bloginfo() instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
header.php
Outdated
| <link rel="shortcut icon" href="<?php echo esc_url( get_stylesheet_directory_uri() ); ?>/images/favicon.ico" /> | ||
| <link rel="pingback" href="<?php echo esc_attr( get_bloginfo( 'pingback_url' ) ); ?>" /> | ||
| <?php if ( is_single() ) { | ||
| echo '<meta property="og:image" content="' . the_post_thumbnail( 'large' ) . '"/>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use get_the_post_thumbnail() instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
Thanks for the review |
|
LGTM code-wise. Waiting for legal feedback… |
This would help greatly if we want to share in twitter or facebook and shows a nice little card. We already done that for Wikipedia articles and Wikidata items.
Useful links: