WordPress.org

Ready to get started?Download WordPress

Forums

Load comment-reply.js only on pages/articles with comments (1 post)

  1. MultiformeIngegno
    Member
    Posted 2 years ago #

    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:
    http://forum.bytesforall.com/showthread.php?t=16900

    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! :)

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by MultiformeIngegno
  • This topic is not resolved
  • WordPress version: 3.3.1