[Support request] Unable to show last updated date on PAGES

Home Forums Support [Support request] Unable to show last updated date on PAGES

Home Forums Support Unable to show last updated date on PAGES

  • This topic has 20 replies, 4 voices, and was last updated 4 days ago by Fernando.
Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
    Posts
  • #2508542
    Vijaykumar

    Hi David
    I have the following pending issues after adding different filters and CSS.

    1) I am not able to remove “article:published_time” from POSTS. I managed to remove it from the pages though.
    <meta property=”article:published_time” content=”2014-03-03T08:45:01+00:00″ />

    2) I am using the CSS below but the text “Last Updated:” is not appearing before the date shown for Posts and Pages in front-end. It is just showing modified date as shown in the screenshot you shared in your last reply.

    .posted-on .updated:before {
    content: “Last Updated: “;
    }

    3) For comments on POSTS, I managed to remove the date content but not the following text. You can check the post url I shared and view source to see comments data.
    Actual date is removed but still following text appearing in page source.
    <time datetime=”” itemprop=”datePublished”>

    #2508562
    David
    Staff
    Customer Support

    Lets deal with the Posts and Pages.
    Remove any PHP and CSS you have that changes the date.

    And add this PHP Snippet:

    add_filter( 'generate_post_date_show_updated_only', '__return_true' );

    It will tell GP to only show the one date.

    Clear any caches after making that change.

    Check to see if thats working and then we can address the other things.

    #2508603
    Vijaykumar

    Hi David

    I have multiple CSS and PHP blocks now to remove the Published date meta tags as well as the Yoast schema datePublished.
    Can you check the CSS and PHP blocks below and let us know which ones to remove?

    CSS changes:

    .posted-on .updated {
        display: inline-block;
    }
    
    .posted-on .updated + .entry-date {
        display: none;
    }
    
    .posted-on .updated:before {
        content: "Last Updated: ";
    }
    
    .entry-date published { 
      display: none; 
    }
    
    .comments-area .comment-date-time { display: none !important;}

    PHP CHANGES: (4 blocks as numbered below)

    
    1) add_filter( 'generate_post_date_show_updated_only', '__return_true' );
    
    2) add_action( 'generate_after_entry_header', 'tu_page_meta' );
    function tu_page_meta() {
    	if ( 'page' == get_post_type() ) : ?>
    		<div class="entry-meta">
    			<?php generate_posted_on(); ?>
    		</div><!-- .entry-meta -->
    	<?php endif;
    }
    
    3) To Remove Comment datePublished 
    
    // Remove comment date
    function wpb_remove_comment_date($date, $d, $comment) { 
        if ( !is_admin() ) {
            return;
        } else { 
            return $date;
        }
    }
    add_filter( 'get_comment_date', 'wpb_remove_comment_date', 10, 3);
     
    // Remove comment time
    function wpb_remove_comment_time($date, $d, $comment) { 
        if ( !is_admin() ) {
                return;
        } else { 
                return $date;
        }
    }
    add_filter( 'get_comment_time', 'wpb_remove_comment_time', 10, 3);
    
    4) To remove Remove date published from the Yoast SEO plugin schema
    
    function vanv_remove_published_date( $graph_piece ) {
    
    	unset( $graph_piece['datePublished'] );
    
    	return $graph_piece;
    
    }
    
    add_filter( 'wpseo_schema_webpage', 'vanv_remove_published_date' );
    add_filter( 'wpseo_schema_article', 'vanv_remove_published_date' );
    #2509230
    Fernando
    Customer Support

    Let’s tackle 1 and 2 first.

    1. This: <meta property=”article:published_time” content=”2014-03-03T08:45:01+00:00″ /> seems to be coming from your SEO plugin.

    Can you try disabling it temporarily to test if it will be removed? Make sure to clear cache before rechecking.

    2. Remove all of these:

    .posted-on .updated {
        display: inline-block;
    }
    
    .posted-on .updated + .entry-date {
        display: none;
    }
    
    .posted-on .updated:before {
        content: "Last Updated: ";
    }
    
    .entry-date published { 
      display: none; 
    }

    Then, add this instead:

    .posted-on .updated-date:before {
        content: "Last Updated: ";
    }
    #2509416
    Vijaykumar

    Hi Fernando
    1 – I think it’s on posts only and not an issue for search engines so we can keep that as it is.
    2 – This is now resolved with the new code. Thanks.
    3 – Any help to remove the line <time datetime=”” itemprop=”datePublished”> from comments (visible when we view post source)? We have currently added code (#3 code block above) for this. It’s removing comment published date but the tag is still there.

    #2509419
    Fernando
    Customer Support

    3. Can you try adding this snippet?:

    add_filter( 'generate_add_comment_date_link', '__return_false' );

    Reference: https://docs.generatepress.com/article/generate_add_comment_date_link/

    Let us know how it goes.

Viewing 6 posts - 16 through 21 (of 21 total)
  • You must be logged in to reply to this topic.