{"id":57315,"date":"2015-11-18T06:45:08","date_gmt":"2015-11-18T11:45:08","guid":{"rendered":"http:\/\/www.templatemonster.com\/help\/?p=57315"},"modified":"2016-01-10T06:17:04","modified_gmt":"2016-01-10T11:17:04","slug":"monstroid-how-to-add-comments-to-custom-posts","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/monstroid-how-to-add-comments-to-custom-posts.html","title":{"rendered":"Monstroid. How to add comments to custom posts"},"content":{"rendered":"<p>This tutorial shows how to enable <strong>comments for custom posts<\/strong> in Monstroid themes.<\/p>\r\n<a href=\"http:\/\/www.youtube.com\/watch?v=ZQWOW0DUiZk?width=1280&amp;height=720\" rel=\"prettyPhoto\">Monstroid. How to add comments to custom posts<\/a>\r\n<p>You&#8217;ll learn how to enable comments for Team posts in this tutorial.<\/p>\r\n\r\n<ol>\r\n<li><p>In order to enable comments for custom posts, you&#8217;ll need to check the <strong>Allow comments<\/strong> option on <strong>Edit Post<\/strong> page. When this option is missing on the Editor page, additional code is required. \r\n  <\/p><\/li>\r\n<li>\r\n  <p>Copy the code required for enabling comments from <a href=\"https:\/\/gist.github.com\/cheh\/ec191fce0d397e10f77f\" target=\"_blank\">https:\/\/gist.github.com\/cheh\/ec191fce0d397e10f77f<\/a> or copy it from below:<\/p>\r\n \r\n<pre class=\"brush:php\"> \/\/ Adds a `comments` support feature for a team single post.\r\n  add_filter( 'cherry_team_post_type_args', 'cherry_child_add_comments_support' );\r\n  function cherry_child_add_comments_support( $args ) {\r\n if ( ! empty( $args['supports'] ) ) {\r\n  $args['supports'][] = 'comments';\r\n  }\r\n return $args;\r\n  }\r\n\/**\r\n  * Loads the comment template in single team post.\r\n  *\r\n  * @see do_action( 'cherry_post_after' ) - hook in plugins\/cherry-XXXX\/templates\/single-XXXX.php file.\r\n  *\/\r\n  add_action( 'cherry_post_after', 'cherry_child_load_comments_template', 25 );\r\n  function cherry_child_load_comments_template() {\r\n  $post_type = get_post_type();\r\nif ( 'team' !== $post_type ) {\r\n  return;\r\n  }\r\n if ( ! is_singular( $post_type ) ) {\r\n  return;\r\n  }\r\n if ( comments_open() || get_comments_number() ) {\r\n  comments_template( '\/templates\/comments.php', true );\r\n  }\r\n  }\r\n\r\n  <\/pre> \r\n<\/li>\r\n  <li>\r\n<p>Next, navigate to <strong>Appearance -> Editor<\/strong>, under themeXXXXX select <strong>functions.php<\/strong> file to edit. Paste the code required at the bottom of the <strong>functions.php<\/strong> file.<\/p><\/li>\r\n  <li>\r\n    <p>To check the changes, go to the <strong>Team tab<\/strong> of admin panel, open any post and scroll it down to find <strong>the Allow Comments<\/strong> option. Check it and update the post:<\/p>\r\n\r\n<a href=\"\/help\/wp-content\/uploads\/2015\/11\/Monstroid.-How-to-add-comments-to-custom-posts-1.png\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2015\/11\/Monstroid.-How-to-add-comments-to-custom-posts-1-300x210.png\" alt=\"Monstroid. How to add comments to custom posts-1\" width=\"300\" height=\"210\" class=\"aligncenter size-medium wp-image-57316\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/11\/Monstroid.-How-to-add-comments-to-custom-posts-1-300x210.png 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/11\/Monstroid.-How-to-add-comments-to-custom-posts-1-150x105.png 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/11\/Monstroid.-How-to-add-comments-to-custom-posts-1.png 1000w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n  <\/li>\r\n<li>\r\n    <p>Refresh front-end with Ctrl\/Cmd+F5 to see the changes. The Comment form will appear on a page:<\/p>\r\n\r\n<a href=\"\/help\/wp-content\/uploads\/2015\/11\/Monstroid.-How-to-add-comments-to-custom-posts-2.png\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2015\/11\/Monstroid.-How-to-add-comments-to-custom-posts-2-300x210.png\" alt=\"Monstroid. How to add comments to custom posts-2\" width=\"300\" height=\"210\" class=\"aligncenter size-medium wp-image-57317\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/11\/Monstroid.-How-to-add-comments-to-custom-posts-2-300x210.png 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/11\/Monstroid.-How-to-add-comments-to-custom-posts-2-150x105.png 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/11\/Monstroid.-How-to-add-comments-to-custom-posts-2.png 1000w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n  <\/li>\r\n<\/ol>\r\n\r\n<p>Feel free to check the detailed video tutorial below:<\/p>\r\n\r\n<a href=\"http:\/\/www.youtube.com\/watch?v=ZQWOW0DUiZk?width=1280&amp;height=720\" rel=\"prettyPhoto\">Monstroid. How to add comments to custom posts<\/a>","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to enable <strong>comments for custom posts<\/strong> in Monstroid themes.<\/p>\n","protected":false},"author":65,"featured_media":57319,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2017,728],"tags":[1331,789,2019,592],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/57315"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=57315"}],"version-history":[{"count":0,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/57315\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/57319"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=57315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=57315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=57315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}