I think the conditional tag which is comments_open()
is not required. That checks if the comments are allowed for that specific page or not.
Try using the following code
<?php
if ( is_single('1740') ||
( !is_home() || !is_front_page() || !is_single() ) ) {
wp_enqueue_script( 'comment-reply' );
} ?>
comments_open()
requires the post ID for the specific posts to check whether the comments are allowed or not. So avoid using the condition for that.
Don’t use is_singular()
with ID as it checks if a singular post is being displayed using the post type name as a parameter. Instead use is_single()
with using the post ID for which you wish to display.
In your above code, the flower bracket was missing too for the if condition.
Hope that helps the question you have asked.
Related Posts:
- Get only enqueued styles and scripts of the current theme
- Display user’s total comment count outside The Loop
- Facebook Comment Count
- Getting the comment number relative to all the post’s comments
- How to output a permanently delete comment link?
- How do I make wordpress comment fields required?
- How do I create comment-reply-button using element not
- Execute only on a certain page
- How to execute a simple php script in WP (I don’t think wp_enque_script applies here)
- How to check if comments are paginated?
- Is it recommended to pass some data to scripts in `wp_enqueue_scripts`?
- if file_exists not working with wp_enqueue_style
- Add “last” and “first” to WordPress Comment Pagination Links
- Uncaught TypeError: Cannot read property ‘firstChild’ of null after upgrading to WordPress 5.5
- Replace comment avatars and links at the same time
- Automatically generate Post/Page from searched Database item?
- Adding ads code between comments
- Adding tawk.to code just before body tag on functions.php file
- How to enqueue CSS and JS only on specific template?
- How do I fetch all comments per post via WP REST API?
- Deregistering a script in WordPress seems impossible
- comments_number display outside specified span
- How does this WordPress Plugin (Thrive Comments) apply their custom comment sort? [closed]
- Show comments menu in dashboard only if the site has comment
- Sending data from custom inputs in WordPress comment form in the admin notification email
- Show wp_die if url form comment not emply
- Why does my callback function not work with this custom filter hook?
- Customize Theme comment template to Insert VoteUp and VoteDown buttons
- How to only enqueue script if it’s a post
- Ajax load more button for comments wordpress
- edit_comment_link is not showing for comment author
- Limit 1 global comment per minute
- wp-comments-post.php file returns a blank page
- Genesis framework comments broken?
- Jquery function working in Dev Console but not otherwise [duplicate]
- jQuery code not working when included in functions.php
- Get post id within comments loop
- Conditional Javascript based on WP Version
- Correct way to enqueue page specific CSS file
- WordPress comment submit button substitutes/options
- How to list commenters and days since last commented
- linking stylesheets and scripts with functions.php
- Double jQuery loaded
- How to add text to the start of all comments?
- Does anyone know all parameters of get_comments()
- Appended comments but they show up above the content instead of below
- get comment data using comment id
- Removing the comment function within wordpress
- wp_delete_comment takes two tries to delete – then deletes all comments
- Change “No Comments” link to “My String” on Blog Post (Find Snippet in Code or use CSS, PHP Solution) [closed]
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- How to use wordpress function wp_enqueue_script() in php?
- Enqueing External JS on the remote server JS
- Trying to enqueue script – Nothing Happens
- Fetching Initials of the Commentator in the WordPress Website
- get_comments_number() returns 0
- url_to_postid returns 0
- How can I include the user id inside of a shortcode php output?
- Restrict characters in comment section
- Conditionally load class in the comment section of the post page
- How to get comment_ID by post_ID in wordpress
- ‘Bones’ theme: Load stock scripts in footer instead of header?
- Enqueueing a code block from an options framework
- Fatal error: Cannot redeclare comment_theme()
- I don’t have comments.php… how do I customize my comment fields
- comment_post (if comment is approved OR $comment_approved === 1) not working?
- Add custom field on admin dashboard comments / reviews
- Show all people who commented on all posts by an author
- How to pass parameters in wordpress shortcode?
- Display the list of user’s comments + the post title + date
- Commenting requires wordpress login, wordpress discussion and post comments tick boxes are checked
- Enqueue assets from multiple directories using add_action/do_action
- Call a single function on two different methods with hooks
- Comments on my custom post type
- Enqueue sripts and styles only if function is called
- Load script and styles using an array of resources
- Importing the style and scripts in the plugin doesn’t work as well as in the theme
- How to add delete, approve, spam Links to Comments
- How to stop loading my custom scripts files for wordpress iframe?
- Real time notification on user profile after new comment
- What’s the correct offset value for order ASC?
- How can I output the slug of a comment author?
- Getting most popular posts based on Facebook comments count
- A Space being added to url generated by custom plugin
- WordPress – show number of comments for each post in widget
- How does add_action ‘comment_post’ work?
- Adding javascript files to WordPress and jQuery version
- Custom action on comment post
- WordPress most commented posts of last X days
- How can I print out a single stylesheet or javascript link?
- Adding Gravity Form With if(is_page) Is Not Working
- How do I call comments_template(); from a plugin file?
- wp_enqueue_style conflict when using in different action hooks
- How to get the rating value of each comment
- Trouble figuring out how to get my button to submit comment
- Errors while Loading Most Recent Version of jQuery
- How to convert my comment.html to comment.php
- Warning: filemtime(): stat failed for wp_
- How to enqueue structured data as file – jsonld file seems not to work
- functions.php doesn’t load all custom theme assets