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?
- count number of user comments with a specific comment meta value
- Trigger a php file on every post or page if a condition is met
- Change comments form title on a page by page basis
- Enqueue less file not working in child theme?
- 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
- Notify WordPress Site I Have Linked To Them
- Add “last” and “first” to WordPress Comment Pagination Links
- enqueue hover function
- 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
- Trying to implement Ajax comments in WordPress, getting WP error
- How does this WordPress Plugin (Thrive Comments) apply their custom comment sort? [closed]
- Show comments menu in dashboard only if the site has comment
- “comments.php” not available after edit in WP administration
- User’s total comment count excluding comments on their own posts
- Sending data from custom inputs in WordPress comment form in the admin notification email
- Show wp_die if url form comment not emply
- How to inject variables into public-facing JS using wp_enqueue_script
- 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
- How to implement a rating and review system for WordPress custom posts?
- Ajax load more button for comments wordpress
- edit_comment_link is not showing for comment author
- Limit 1 global comment per minute
- Create Page To Count Comments For Each Post In WordPress Site
- comments sorting incorrectly across multiple pages
- Commenting out unwated CSS/scripts in HTML with PHP
- wp-comments-post.php file returns a blank page
- php function to display commenter username or login
- WordPress Scripts Being Loaded in Footer
- Genesis framework comments broken?
- check if comment submitted was successful
- Jquery function working in Dev Console but not otherwise [duplicate]
- jQuery code not working when included in functions.php
- Alter required message using comment form api
- Get post id within comments loop
- Conditional Javascript based on WP Version
- Is the wp_enqueue method efficient?
- 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
- 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?
- Chosen Select jquery Not Working in Plugin
- 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
- Make a variable global and use it for inline script
- Guests comment form – prevent duplicate email addresses
- functions.php doesn’t load all custom theme assets
- Permissions error when I use my plugin to delete comments in the front-end
- Pre_get_comments and orderby comment_karma
- Remove links to the comments section
- in_footer: gives syntax error
- Custom gutenberg block refuses to load viewScript and I don’t know why
- Removing website URL in comments causes misalignment of submit button and tickbox
- WordPress generating Undefined Variable warning