Join our new community forum for support & discussion

Join Now

Home Support Extensions Requests Is this the correct code if I want to allow writing standard WordPress comments?

Is this the correct code if I want to allow writing standard WordPress comments?

  • Author
    Posts
  • Sergio
    1. Is this the correct code if I want to allow writing standard WordPress comments on the request page?
    2. And how to include another file with the comments template instead of the standard comments.php?
    add_filter( 'hivepress/v1/post_types', 'comment_request_page' );
    function comment_request_page ( $post_types ) {
    		$post_types['request']['supports'][] = 'comments';
    		return $post_types;
    }
    add_filter( 'hivepress/v1/templates/request_view_page', 'comment_request_page_two' );
    function comment_request_page_two ( $template ) {
    		return hivepress()->helper->merge_trees(
    			$template,
    			[
    				'blocks' => [
    					'page_content' => [
    						'blocks' => [
    							'request_comments' => [
    								'type'     => 'callback',
    								'callback' => 'comments_template',
    								'_order'   => 110,
    							],
    						],
    					],
    				],
    			]
    		);
    	}
    ihor developer

    Seems like it’s correct, but it may require more customizations, for example the regular comment feed may also display offers (these are also comments). The comments_template() function loads the comments.php file by default, loading another one would require further customizations.

Viewing 2 posts - 1 through 2 (of 2 total)

New Reply

This forum has been archived and is no longer accepting new posts or replies. Please join our new community forum for support & discussion.