Last active
August 28, 2017 03:17
-
-
Save carlosonweb/1b39a3522faeccdac1d9d628941d33a3 to your computer and use it in GitHub Desktop.
Beaver Builder Customer Request: Modify the Schema Object for the author by removing the author URI
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
<?php | |
if( !function_exists('bblocal_post_schema_meta')){ | |
// Copied from FLTheme::post_schema_meta(); | |
// This function is invoked at the last line of this file. | |
function bblocal_post_schema_meta() | |
{ | |
// General Schema Meta | |
echo '<meta itemscope itemprop="mainEntityOfPage" itemid="' . get_permalink() . '" />'; | |
echo '<meta itemprop="datePublished" content="' . get_the_time('Y-m-d') . '" />'; | |
echo '<meta itemprop="dateModified" content="' . get_the_modified_date('Y-m-d') . '" />'; | |
// Publisher Schema Meta | |
echo '<div itemprop="publisher" itemscope itemtype="https://schema.org/Organization">'; | |
echo '<meta itemprop="name" content="' . get_bloginfo( 'name' ) . '">'; | |
if ( 'image' == FLTheme::get_setting( 'fl-logo-type' ) ) { | |
echo '<div itemprop="logo" itemscope itemtype="https://schema.org/ImageObject">'; | |
echo '<meta itemprop="url" content="' . FLTheme::get_setting( 'fl-logo-image' ) . '">'; | |
echo '</div>'; | |
} | |
echo '</div>'; | |
// Author Schema Meta | |
echo '<div itemscope itemprop="author" itemtype="http://schema.org/Person">'; | |
// --- Remove the Author URL | |
//echo '<meta itemprop="url" content="' . get_author_posts_url( get_the_author_meta( 'ID' ) ) . '" />'; | |
// Remove the Author Name | |
//echo '<meta itemprop="name" content="' . get_the_author_meta( 'display_name', get_the_author_meta( 'ID' ) ) . '" />'; | |
echo '</div>'; | |
// Image Schema Meta | |
if(has_post_thumbnail()) { | |
$image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full'); | |
if ( is_array( $image ) ) { | |
echo '<div itemscope itemprop="image" itemtype="http://schema.org/ImageObject">'; | |
echo '<meta itemprop="url" content="' . $image[0] . '" />'; | |
echo '<meta itemprop="width" content="' . $image[1] . '" />'; | |
echo '<meta itemprop="height" content="' . $image[2] . '" />'; | |
echo '</div>'; | |
} | |
} | |
// Comment Schema Meta | |
echo '<div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter">'; | |
echo '<meta itemprop="interactionType" content="http://schema.org/CommentAction" />'; | |
echo '<meta itemprop="userInteractionCount" content="' . wp_count_comments(get_the_ID())->approved . '" />'; | |
echo '</div>'; | |
} | |
} | |
//------------------------------ | |
// Wrapper | |
if($show_author || $show_date || $comments) { | |
echo '<div class="fl-post-meta fl-post-meta-top">'; | |
do_action( 'fl_post_top_meta_open' ); | |
} | |
// Author | |
if ( $show_author ) { | |
echo '<span class="fl-post-author">'; | |
printf( _x( 'By %s', 'Post meta info: author.', 'fl-automator' ), '<a href="' . get_author_posts_url( get_the_author_meta( 'ID' ) ) . '"><span>' . get_the_author_meta( 'display_name', get_the_author_meta( 'ID' ) ) . '</span></a>' ); | |
echo '</span>'; | |
} | |
// Date | |
if($show_date) { | |
if($show_author) { | |
echo '<span class="fl-sep"> | </span>'; | |
} | |
echo '<span class="fl-post-date">' . get_the_date() . '</span>'; | |
} | |
// Comments | |
if($comments && $comment_count) { | |
if($show_author || $show_date) { | |
echo '<span class="fl-sep"> | </span>'; | |
} | |
echo '<span class="fl-comments-popup-link">'; | |
comments_popup_link('0 <i class="fa fa-comment"></i>', '1 <i class="fa fa-comment"></i>', '% <i class="fa fa-comment"></i>'); | |
echo '</span>'; | |
} | |
// Close Wrapper | |
if($show_author || $show_date || $comments) { | |
do_action( 'fl_post_top_meta_close' ); | |
echo '</div>'; | |
} | |
// Schema Meta | |
// FLTheme::post_schema_meta(); | |
bblocal_post_schema_meta(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment