sierre

Comments Form: Functions.php

Jun 3rd, 2022 (edited)
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.88 KB | None | 0 0
  1. <?php
  2. function comment_support_for_my_custom_post_type() {
  3.      add_post_type_support( 'my_post_type', 'comments' );
  4. }
  5. add_action( 'init', 'comment_support_for_my_custom_post_type' );
  6.  
  7. function collectiveray_enable_threaded_comments(){
  8. // if (!is_admin()) {
  9.     if (is_singular() AND comments_open() AND (get_option('thread_comments') == 1))
  10.         wp_enqueue_script('comment-reply');
  11.     }
  12. // }
  13. add_action('get_header', 'collectiveray_enable_threaded_comments');
  14.  
  15. // Change comment date format
  16. add_filter( 'get_comment_date', 'custom_comment_date_format' );
  17. function custom_comment_date_format( $d ) {
  18.     $d = date("m.d.y");
  19.     return $d;
  20. }
  21.  
  22. // Remove word " at" from date format
  23.  
  24.  
  25. // Remove comment time
  26. /*function remove_comment_time($date, $d, $comment) {
  27.     if ( !is_admin() ) {
  28.             return;
  29.     } else {
  30.             return $date;
  31.     }
  32. }
  33. add_filter( 'get_comment_time', 'remove_comment_time', 10, 3);
  34. */
  35.  
  36. /*
  37. function not_default_comments( $comment, $args, $depth ) {
  38.     global $post;
  39.     $author_id = $post->post_author;
  40.     $GLOBALS['comment'] = $comment;
  41. ?>
  42.     <li id="li-comment-<?php comment_ID(); ?> comment">
  43.         <article id="comment-body" <?php comment_class('clr'); ?>>
  44.             <div class="comment-author vcard">
  45.                 <?php echo get_avatar( $comment, 45 ); ?>
  46.             </div><!-- .comment-author -->
  47.             <div class="comment-details clr">
  48.                 <header class="comment-meta">
  49.                     <cite class="fn"><?php comment_author_link(); ?></cite>
  50.                     <span class="comment-date">
  51.                     <?php printf( '<a href="%1$s"><time datetime="%2$s">%3$s</time></a>',
  52.                         esc_url( get_comment_link( $comment->comment_ID ) ),
  53.                         get_comment_time( 'c' ),
  54.                         sprintf( _x( '%1$s', '1: date', 'twenties' ), get_comment_date() )
  55.                     ); ?>
  56.                     </span><!-- .comment-date -->
  57.                 </header><!-- .comment-meta -->
  58.                 <?php if ( '0' == $comment->comment_approved ) : ?>
  59.                     <p class="comment-awaiting-moderation"><?php esc_html_e( 'Your comment is awaiting moderation.', 'twenties' ); ?></p>
  60.                 <?php endif; ?>
  61.                 <div class="comment-content entry clr">
  62.                     <?php comment_text(); ?>
  63.                 </div><!-- .comment-content -->
  64.                 <div class="reply comment-reply-link">
  65.                     <?php comment_reply_link( array_merge( $args, array(
  66.                         'reply_text' => esc_html__( 'Reply to this message', 'twenties' ),
  67.                         'depth'      => $depth,
  68.                         'max_depth'  => $args['max_depth'] )
  69.                     ) ); ?>
  70.                 </div><!-- .reply -->
  71.             </div><!-- .comment-details -->
  72.         </article><!-- #comment-## -->
  73.     <?php
  74. }
  75. */
Add Comment
Please, Sign In to add comment