Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1097277

    AndrewStressline
    Participant

    Hi
    I have added and since removed a schema structured data plugin, but the data is still on the posts. It doesn’t look very good, so i deleted the plugin. The data is still in the posts and it still generates the schema data on new posts even after I have deleted the plugin.

    I have looked at the source code and tried to find out where the code is in the theme but cannot find it anywhere. I contacted the plugin author who stated it was a theme issue. Can you advise please?

    http://www.stressline.net
    example post – http://www.stressline.net/stressline-limited-launches-new-website-and-e-newsletter/
    you will see the unsightly schema data at the bottom of the post.

    I am using a child theme.

    Thanks

    #1097315

    Rahul
    Moderator

    Hi there,
    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:
    – Link to your site
    – WordPress Admin username / password
    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.
    Thanks.

    #1097428

    AndrewStressline
    Participant
    This reply has been marked as private.
    #1097441

    AndrewStressline
    Participant

    Hi….
    come to think of it, I put this code in the functions.php file – could it be this???

    add_filter(‘get_the_excerpt’, ‘modified_date_updated_excerpt’);
    function modified_date_updated_excerpt( $excerpt ) {
    if ( !is_single() || !is_singular() ) {
    return $excerpt . ‘<br><div class=”hatom-extra”><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><br><br></div>’;
    } else {
    return $excerpt;
    }
    }

    add_filter(‘the_content’, ‘modified_date_updated_content’);
    function modified_date_updated_content( $content ) {
    if ( !isset($_GET[‘cornerstone’]) && $_GET[‘cornerstone’] != 1 && !is_page() ) {
    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;
    }

    #1097870

    Rue Nel
    Moderator

    Hello There,

    Thanks for the updates! Yes that code adds a structure data in your post and pages. If you want to remove it, you can just comment out the add filter so that you do not have to remove it from your child theme’s functions.php file. You might need it in your other sites someday. Please update the code and use this instead:

    // Google Structured Data Fix for Excerpts
    // =============================================================================
    
    //add_filter('get_the_excerpt', 'modified_date_updated_excerpt');
    function modified_date_updated_excerpt( $excerpt ) {
      if ( !is_single() || !is_singular() ) {
        return $excerpt . '<br><div class="hatom-extra"><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><br><br></div>';
      } else {
        return $excerpt;
      }
    }
    
    //add_filter('the_content', 'modified_date_updated_content');
    function modified_date_updated_content( $content ) {
      if ( !isset($_GET['cornerstone']) && $_GET['cornerstone'] != 1 && !is_page() ) {
        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;
      }
    }

    After commenting out // the add_filter() function, since you have installed a caching plugin W3 Total Cache, please clear your plugin cache before testing your site. This can cause the changes to not take place on the front end. It will eventually show up when the cache regenerates, but it’s not ideal if you’re looking to see your changes immediately. Caching plugins are best to turn on only when you’ve finished building the site.

    Hope this helps. Please let us know how it goes.