Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1125832
    garlicfox
    Participant

    Hello,

    I was just wondering if this is something I’ve miss-configured or if it’s a theme problem. Google search console is reporting errors (see attached image) on the /articles/ page but each post is showing that these authorship items are included and there were no problems, so it appears only to be on the /articles/ page where we have a summary of each article.

    Is there a way I can satisfy the google gods and get this error fixed up? Not sure if this is a theme modification (which i’m running a child theme already so editing it should be pretty easy)..

    thanks and much appreciated.

    #1125834
    garlicfox
    Participant
    This reply has been marked as private.
    #1125862
    Rahul
    Moderator

    Hey There,

    Thanks for writing in!

    You can follow this thread regarding your Google Search Console Errors :

    https://community.theme.co/forums/topic/hentry-microformats-org-error-in-google-search-console/#post-821751

    Hope it helps!

    #1131941
    garlicfox
    Participant

    Hello,

    I followed that code and I still can’t seem to get it to show. I’ll put some screenshots below of the code changes I made to the x-child functions.php theme. I’ve also cleared out all my cache and still not having any luck.

    I was wondering if you had any suggestions (screenshots in the next private post below)

    Much appreciated.

    #1131945
    garlicfox
    Participant
    This reply has been marked as private.
    #1132074
    Rupok
    Member

    Hi there,

    Can you paste the whole code here? Kindly wrap with code from the Toolbar to prevent unwanted formatting.

    Cheers!

    #1132613
    garlicfox
    Participant

    Sure! If it makes any difference I’m using the renew stack.

    // Structure Data Fix
    // ==========================
    //add hatom data
    function add_suf_hatom_data($content) {
        $t = get_the_modified_time('F jS, Y');
        $author = get_the_author();
        $title = get_the_title();
    if (is_home() || is_singular() || is_archive() ) {
            $content .= '<div class="hatom-extra" style="display:none;visibility:hidden;"><span class="entry-title">'.$title.'</span> was last modified: <span class="updated"> '.$t.'</span> by <span class="author vcard"><span class="fn">'.$author.'</span></span></div>';
        }
        return $content;
        }
    add_filter('the_content', 'add_suf_hatom_data');
    
    add_filter('the_content', 'modified_date_updated_content');
    function modified_date_updated_content( $content ) {
      if ( !isset($_GET['cornerstone']) && $_GET['cornerstone'] != 1 && !is_page() && !is_singular( 'x-portfolio' ) ) {
        return $content . '<br><div class="hatom-extra"><span class="entry-title">'. get_the_title() .'</span> was last modified: <span class="updated"> '. get_the_modified_time('F jS, Y') .'</span> by <span class="author vcard"><span class="fn">'. get_the_author() .'</span></span><br><br></div>';
      } else {
        return $content;
      }
    }
    
    #1133206
    Rad
    Moderator

    Hi there,

    That code is only applicable on single posts since blog home page doesn’t have the_content filter. Please add this code too,

    function remove_hentry_class( $classes ) {
        if ( is_home() ) {
           $classes = array_diff( $classes, array( 'hentry' ) );
        }
        return $classes;
    }
    
    add_filter( 'post_class', 'remove_hentry_class', 999 );

    Hope this helps.

    #1133375
    garlicfox
    Participant

    Hello,

    Sorry I think there is some confusion. I actually want the missing: author + updated to be showing but with data. I don’t want to remove them as I want these pages to have structure data, so how would I get this data in there? Would I use xtheme for that or another plugin?

    #1134263
    Rad
    Moderator

    Hi there,

    I’m not sure why you need author data on non-post page. The error is there because of the existence of hentry, and google crawler expect data within it. Even if you add author data on blog home page, but it’s outside of hentry block then the same error will persist. Hence, let’s remove hentry then add your author data to the footer.

    function remove_hentry_class( $classes ) {
        if ( is_home() ) {
           $classes = array_diff( $classes, array( 'hentry' ) );
        }
        return $classes;
    }
    
    add_filter( 'post_class', 'remove_hentry_class', 999 );
    
    // Structure Data Fix
    // ==========================
    //add hatom data
    function add_suf_hatom_data($content) {
        $t = get_the_modified_time('F jS, Y');
        $author = get_the_author();
        $title = get_the_title();
    if (is_home() || is_singular() || is_archive() ) {
            $content .= '<div class="hatom-extra" style="display:none;visibility:hidden;"><span class="entry-title">'.$title.'</span> was last modified: <span class="updated"> '.$t.'</span> by <span class="author vcard"><span class="fn">'.$author.'</span></span></div>';
        }
    
        if ( is_home() ) echo $content; else  return $content;
    
        }
    add_filter('the_content', 'add_suf_hatom_data');
    add_action('wp_footer', 'add_suf_hatom_data');
    
    add_filter('the_content', 'modified_date_updated_content');
    add_action('wp_footer', 'modified_date_updated_content');
    
    function modified_date_updated_content( $content ) {
      if ( !isset($_GET['cornerstone']) && $_GET['cornerstone'] != 1 && !is_page() && !is_singular( 'x-portfolio' ) ) {
        
        $content .= '<br><div class="hatom-extra"><span class="entry-title">'. get_the_title() .'</span> was last modified: <span class="updated"> '. get_the_modified_time('F jS, Y') .'</span> by <span class="author vcard"><span class="fn">'. get_the_author() .'</span></span><br><br></div>';
    
        if ( is_home() ) echo $content; else  return $content;
    
      } else {
        return $content;
      }
    }

    Hope this helps.

    #1135196
    garlicfox
    Participant

    Thanks it does, and thank you for explaining it. I’ve made all these changes and will report back in a week or so once everything gets re-crawled.

    #1135318
    Rahul
    Moderator

    That’s great!

    We will standby for you.

    #1135710
    garlicfox
    Participant
    This reply has been marked as private.
    #1136184
    Rue Nel
    Moderator

    Hello There,

    Thanks for providing the screenshots and your code. By default, in WordPress without doing anything, the “hentry” class were already added. You can check it here: http://prntscr.com/c74pcr

    Now, your first block of code removes the hentry class. I am not sure what is your purpose of doing that. Please clarify.

    Secondly, you have duplicate entry above your page because of your code. If you want to use only once and within the article, please have your code updated and use this instead:

    // Structure Data Fix
    // ==========================
    //add hatom data
    function add_suf_hatom_data($content) {
        $t = get_the_modified_time('F jS, Y');
        $author = get_the_author();
        $title = get_the_title();
    	
    	if (is_home() || is_singular() || is_archive() ) {
            $content .= '<div class="hatom-extra" style="display:none;visibility:hidden;"><span class="entry-title">'.$title.'</span> was last modified: <span class="updated"> '.$t.'</span> by <span class="author vcard"><span class="fn">'.$author.'</span></span></div>';
        }
    
        if ( is_home() ) echo $content; else  return $content;
    
    }
    add_filter('the_content', 'add_suf_hatom_data');
    
    add_filter('the_content', 'modified_date_updated_content');
    function modified_date_updated_content( $content ) {
      if ( !isset($_GET['cornerstone']) && $_GET['cornerstone'] != 1 && !is_page() && !is_singular( 'x-portfolio' ) ) {
    
        $content .= '<br><div class="hatom-extra"><span class="entry-title">'. get_the_title() .'</span> was last modified: <span class="updated"> '. get_the_modified_time('F jS, Y') .'</span> by <span class="author vcard"><span class="fn">'. get_the_author() .'</span></span><br><br></div>';
    
        if ( is_home() ) echo $content; else  return $content;
    
      } else {
        return $content;
      }
    }
    

    Hope this helps.

    #1136634
    garlicfox
    Participant
    This reply has been marked as private.
  • <script> jQuery(function($){ $("#no-reply-1125832 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>