Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1203768
    Chgrim
    Participant

    Hi,

    I recently added some code to my theme to fix the google Missing: author and Missing: updated hentry problem. The only catch is that it now writes (article) was last modified: October 5th, 2016 by (owner) on each post. Is there a way to hide those words but still have it for the google hentry problem?

    You can see an example here

    Canny Review

    it actually put it on two different places on that page.

    Here is the code I added to the function.php

    // Fix “Missing Author” and “Missing Updated” issue – START
    // =============================================================================
    add_filter( ‘the_content’, ‘custom_author_code’);

    function custom_author_code($content) {
    if (is_singular() || is_single()) {
    return $content .
    ‘<div class=”hatom-extra hidden”><span class=”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></div>’ ;
    } else {
    return $content;
    }
    }
    // =============================================================================

    Thanks
    Chris

    #1203857
    Darshana
    Moderator

    Hi there,

    Thanks for writing in! Try adding the following code instead.

    
    add_filter( 'the_content', 'custom_author_code');
    
    function custom_author_code($content) {
       if (is_singular() || is_single()) {
          return $content . 
          '<div class="hatom-extra hidden"><span class="title">'. get_the_title() .' </span> by <span class="author vcard"><span class="fn">'. get_the_author() .'</span></span></div>' ;
       } else {
          return $content;
       }
    }
    

    Hope that helps.

    #1203936
    Chgrim
    Participant

    Hi!

    Thanks for getting back so quickly.

    So that tweak changed the wording, but the actual “Canny Review by Nadia Delay” is still visible in the post. Also, it is still in two locations on the post.

    Canny Review

    Thanks
    Chris

    #1204143
    Lely
    Moderator

    Hi Chris,

    Please also try adding this custom CSS:

    .hatom-extra.hidden {
        display: none;
    }

    Hope this helps.

    #1204484
    Chgrim
    Participant

    That worked! You guys rock. This is probably the best customer support I have ever had. Keep it up!

    #1204548
    Lely
    Moderator

    You’re welcome and thank you for the kind words!

    Cheers!

    #1221465
    Chgrim
    Participant

    Hi,

    One extra question! So google webmaster tools is still showing “Missing: updated” on all of my pages. What code do I need to add so that goes away?

    Thanks
    Chris

    #1221940
    Lely
    Moderator

    Hi Chris,

    Please try updating the code to this:

    add_filter( 'the_content', 'custom_author_code');
    
    function custom_author_code($content) {
       if (is_singular() || is_single()) {
          return $content . 
          '<div class="hatom-extra hidden"><span class="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></div>' ;
       } else {
          return $content;
       }
    }

    Hope this helps.

    #1222693
    Chgrim
    Participant

    Thanks!

    I added the code and I will let you know after google has had time to crawl it!

    You guys rock.
    Chris

    #1222818
    Nabeel A
    Moderator

    Glad we could help.

    Cheers!

  • <script> jQuery(function($){ $("#no-reply-1203768 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>