-
AuthorPosts
-
May 8, 2016 at 9:42 pm #628918
Hello,
Enfold’s schema markup displays a “name” property and a “logo”property for the Organization itemtype. It’s showing my personal name while offering my company logo. Is there a way to change this so it correctly display the company’s name instead of my personal name? Here is what is being displayed on page:
<span class='av-structured-data' itemprop="publisher" itemtype="https://schema.org/Organization" itemscope="itemscope" > <span itemprop='name'> Kyle Schmidt </span> <span itemprop='logo' itemscope itemtype='http://schema.org/ImageObject'> <span itemprop='url'> http://blog.bluepipes.com/wp-content/uploads/2013/12/bluepipes-logo-blog-7g7-300x137.png </span> </span> </span>
Thanks!
KyleMay 10, 2016 at 5:54 pm #630150Hey kls1138,
Would you mind providing a precise link to your site, showing the elements in question? We need to be able to inspect them in order to help :)
Best regards,
AndyMay 10, 2016 at 7:20 pm #630197I provided a link in the “Private Content” field. Just a heads up: I removed the markup for “datePublished” and “dateModified” as these have a negative impact on my site’s SERP rankings. However, this doesn’t affect the markup for “publisher” / “Organization”. The markup is the same with or without the markup for the dates.
Thanks!
May 12, 2016 at 8:44 am #631208Hi,
Use the “avf_author_name” filter or modify the “av_blog_entry_markup_helper” function in the functions.php file:
function av_blog_entry_markup_helper( $id , $exclude = array()) { $logo = $logo_url = $logo_h = $logo_w = $url_string = $url_h = $url_w = ""; $post = get_post($id); if($logo = avia_get_option('logo')) { $logo = apply_filters('avf_logo', $logo); if(is_numeric($logo)){ $logo = wp_get_attachment_image_src($logo, 'full'); $logo_url = $logo[0]; } else { $logo_url = $logo; } } $thumb_id = get_post_thumbnail_id($id); if($thumb_id) { $url = wp_get_attachment_image_src($thumb_id, 'full'); $url_string = $url[0]; $url_w = $url[1]; $url_h = $url[2]; } else { if(is_array($logo)){ $url_string = $logo[0]; $url_w = $logo[1]; $url_h = $logo[2]; } else { $url_string = $logo; $url_w = 0; $url_h = 0; } } $author_name = apply_filters('avf_author_name', get_the_author_meta('display_name', $post->post_author), $post->post_author); $publisher_markup = avia_markup_helper(array('context' => 'blog_publisher','echo'=>false)); $author_markup = avia_markup_helper(array('context' => 'author','echo'=>false)); $date_markup = avia_markup_helper(array('context' => 'blog_date_modified','echo'=>false)); $entry_time_markup = avia_markup_helper(array('context' => 'entry_time','echo'=>false)); $main_entity_markup = avia_markup_helper(array('context' => 'blog_mainEntityOfPage','echo'=>false)); $image_markup = avia_markup_helper(array('context' => 'image','echo'=>false)); $output = ""; if( !in_array('image', $exclude) ) { $output .= " <span class='av-structured-data' {$image_markup} itemprop='image'> <span itemprop='url' >{$url_string}</span> <span itemprop='height' >{$url_h}</span> <span itemprop='width' >{$url_w}</span> </span>"; } if( !in_array('publisher', $exclude) ) { $output .= "<span class='av-structured-data' {$publisher_markup}> <span itemprop='name'>{$author_name}</span> <span itemprop='logo' itemscope itemtype='http://schema.org/ImageObject'> <span itemprop='url'>{$logo_url}</span> </span> </span>"; } if( !in_array('author', $exclude) ) { $output .= "<span class='av-structured-data' {$author_markup}><span itemprop='name'>{$author_name}</span></span>"; } if( !in_array('date', $exclude) ) { $output .= "<span class='av-structured-data' {$entry_time_markup}>{$post->post_date}</span>"; } if( !in_array('date_modified', $exclude) ) { $output .= "<span class='av-structured-data' {$date_markup}>{$post->post_modified}</span>"; } if( !in_array('mainEntityOfPage', $exclude) ) { $output .= "<span class='av-structured-data' {$main_entity_markup}><span itemprop='name'>{$post->post_title}</span></span>"; } if(!empty($output)) $output = "<span class='hidden'>{$output}</span>"; return $output; }
Adjust this line:
$author_name = apply_filters('avf_author_name', get_the_author_meta('display_name', $post->post_author), $post->post_author);
Best regards,
IsmaelMay 17, 2016 at 10:46 pm #634069Thanks for the reply, Ismael. My apologies, but I’m a bit confused. It’s recommended to adjust a line of code that affects the $author_name variable. However, this variable is used in two places. It’s used to correctly display the name of the author in: if( !in_array(‘author’, $exclude) )…It’s also used incorrectly to display the name of the publisher (identified as an organization) in: if( !in_array(‘publisher’, $exclude) )…
I believe this is a mistake in the theme’s av_blog_entry_markup_helper function that should be fixed. ‘$author_name’ should not be used for the <span itemprop=’name’> of the Organization in the publisher markup. I believe there should be a separate variable to hold the name of the organization, or this markup should be removed from the theme’s schema markup altogether.
That said, I patched the issue by hard-coding the company’s name in the publisher markup: <span itemprop=’name’>Company Name</span>
Thanks!
May 18, 2016 at 6:54 am #634197Hi!
Will forward that to Kriesi and he can check if it is wrong, and to be fixed.
Thanks a lot for your bug hunting and for letting us know, we do appreciate that a lot.Best regards,
Basilis -
AuthorPosts
- You must be logged in to reply to this topic.