Notifications
Clear all

[Solved] show comments from another page

3 Posts
2 Users
0 Likes
806 Views
(@face2005)
New Member
Joined: 6 years ago
Posts: 2
Topic starter  

Hello! there is a "reviews" page, there are wpDiscuz comments .. how to duplicate these wpDiscuz comments on the main page for example ...


   
Astghik
(@astgh)
Illustrious Member Admin
Joined: 6 years ago
Posts: 5872
 

Hi @face2005,

wpDiscuz doesn't have such a feature, However, I've contacted plugin developers they provide a solution for you. Please follow the steps below:

1. Put the codes in the functions.php file of the active theme:

 

add_filter("wpdiscuz_js_options", function ($optionsJs){
   if (is_front_page()) {
       $optionsJs["wc_post_id"] = X;
   }
return $optionsJs;
});
add_filter("is_load_wpdiscuz", function ($load){
   if (is_front_page()) {
    $load = true;
   }
return $load;
}) 

 

2. This code should be added in the page content where you'd like to add duplicated comments: 

if (is_front_page()) {
$oldId = get_the_ID();
$post = get_post(X);
comments_template();
$post = get_post($oldId);
} else {
comments_template();
} 

Please change the value of the red marked code. You should use the page_Id whose comments should be loaded on the current page instead of the X

We cannot guarantee that this will work in 100% as far as this is just a quick solution and Product Modifications and Customization is not included in our Support. 

 


   
(@face2005)
New Member
Joined: 6 years ago
Posts: 2
Topic starter  

Hello! Cool! Everything works, thank you!


   
Share:
Scroll to top