Support » Fixing WordPress » Load comment-reply.js only on pages/articles with comments

  • Hi! 🙂
    I’d like to have comment-reply.js only loaded on articles/pages with comments open (and disabled elsewhere, e.g. custom template pages where comment template is not even called). I found this:

    But how to achieve that on TwentyEleven (child theme, header.php). There’s this line:
    if ( is_singular() && get_option( ‘thread_comments’ ) )
    wp_enqueue_script( ‘comment-reply’ );

    should be changed to something like:
    if ( is_singular() && get_option( ‘thread_comments’ ) && comments_open( $post_id ) )
    wp_enqueue_script( ‘comment-reply’ );

    But unfortunately I don’t know PHP much.. can you help me?

    Thanks in advance! 🙂

  • The topic ‘Load comment-reply.js only on pages/articles with comments’ is closed to new replies.