Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proper escape excerpts and descriptions in og tags #1279

Merged
merged 1 commit into from
Aug 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions inc/open-graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ function largo_opengraph() {
<meta property="og:title" content="<?php the_title(); ?>" />
<meta property="og:type" content="article" />
<meta property="og:url" content="<?php the_permalink(); ?>"/>
<meta property="og:description" content="<?php echo strip_tags( get_the_excerpt() ); ?>" />
<meta name="description" content="<?php echo strip_tags( get_the_excerpt() ); ?>" />
<meta property="og:description" content="<?php echo strip_tags( esc_html( get_the_excerpt() ) ); ?>" />
<meta name="description" content="<?php echo strip_tags( esc_html( get_the_excerpt() ) ); ?>" />
<?php
} // have_posts

rewind_posts();

} elseif ( is_home() ) { ?>

<meta property="og:title" content="<?php bloginfo( 'name' ); echo ' - '; bloginfo('description'); ?>" />
<meta property="og:title" content="<?php bloginfo( 'name' ); echo ' - '; bloginfo( 'description' ); ?>" />
<meta property="og:type" content="website" />
<meta property="og:url" content="<?php echo home_url(); ?>"/>
<meta property="og:description" content="<?php bloginfo( 'description' ); ?>" />
Expand All @@ -76,8 +76,8 @@ function largo_opengraph() {
$description = get_bloginfo( 'description' );
}
if ( $description ) {
echo '<meta property="og:description" content="' . strip_tags( $description ) . '" />';
echo '<meta name="description" content="' . strip_tags( $description ) . '" />';
echo '<meta property="og:description" content="' . strip_tags( esc_html( $description ) ) . '" />';
echo '<meta name="description" content="' . strip_tags( esc_html( $description ) ) . '" />';
}
} // else

Expand Down