• Resolved Michael

    (@famsource)


    Hello, I am trying to get the comments date format to match the WP general setting date format. All date formats across my website are good except for the comments, they look terrible. I am trying to get that format the same but have not been successful. I can change the look with CSS but need the format to be uniformed with the rest of my website. I have attached 4 screenshots in hopes that they will help find a resolution to this issue. On the screenshot with the “submitted” date, you can see the format is altered away from the main settings, yet the accepted date next to it is correct. It seems the comment date is pulling from that format, which I have no idea why it is like that. Thank you in advance for any help as I am not a coder.

    https://imgur.com/Cu36o1P – Comments Tab

    https://imgur.com/DmVN3oJ – WP Date Format

    https://imgur.com/Qz7Zg7Q – Post Comments

    https://imgur.com/IIlatUe – Post Meta

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    I don’t think it is possible to change the comment date format. But you can try the below code. Try adding the code to the oceanwp child theme’s functions.php file and edit the comment date format in the code –

    if ( ! function_exists( 'oceanwp_comment' ) ) {
    
    	function oceanwp_comment( $comment, $args, $depth ) {
    
    		switch ( $comment->comment_type ) :
    			case 'pingback' :
    			case 'trackback' :
    			// Display trackbacks differently than normal comments.
    		?>
    
    		<li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
    
    			<article id="comment-<?php comment_ID(); ?>" class="comment-container">
    				<p><?php esc_html_e( 'Pingback:', 'oceanwp' ); ?> <span><span<?php oceanwp_schema_markup( 'author_name' ); ?>><?php comment_author_link(); ?></span></span> <?php edit_comment_link( esc_html__( '(Edit)', 'oceanwp' ), '<span class="edit-link">', '</span>' ); ?></p>
    			</article>
    
    			<?php
    			break;
    				default :
    				// Proceed with normal comments.
    				global $post;
    			?>
    
    			<li id="comment-<?php comment_ID(); ?>" class="comment-container">
    
    				<article <?php comment_class( 'comment-body' ); ?>>
    
    					<?php echo get_avatar( $comment, apply_filters( 'ocean_comment_avatar_size', 150 ) ); ?>
    
    		            <div class="comment-content">
    		                <div class="comment-author">
    		                    <h3 class="comment-link"><?php printf( esc_html__( '%s ', 'oceanwp' ), sprintf( '%s', get_comment_author_link() ) ); ?></h3>
    
    		                    <span class="comment-meta commentmetadata">
    		                    	<?php if ( ! is_rtl() ) { ?>
    		                        	<span class="comment-date"><?php comment_date('j M Y'); ?></span>
    		                        <?php } ?>
    
    		                        <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    
    		                        <?php edit_comment_link(__('edit', 'oceanwp' )); ?>
    
    		                    	<?php if ( is_rtl() ) { ?>
    		                        	<span class="comment-date"><?php comment_date('j M Y'); ?></span>
    		                        <?php } ?>
    		                    </span>
    		                </div>
    
    		                <div class="clr"></div>
    
    		                <div class="comment-entry">
    		                    <?php if ( '0' == $comment->comment_approved ) : ?>
    		                        <p class="comment-awaiting-moderation"><?php esc_html_e( 'Your comment is awaiting moderation.', 'oceanwp' ); ?></p>
    		                    <?php endif; ?>
    
    		                    <div class="comment-content">
    		                        <?php comment_text(); ?>
    		                    </div>
    		                </div>
    		            </div>
    
    				</article><!-- #comment-## -->
    
    			<?php
    			break;
    		endswitch; // end comment_type check
    	}
    
    }
    Thread Starter Michael

    (@famsource)

    @apprimit Thank you again, this worked perfectly. Just had to make some small minor changes to the format code and CSS, but was exactly what I was trying to do!

    You’re welcome!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Post comments dates format different from WP general date settings’ is closed to new replies.