admin管理员组

文章数量:1302333

I use ACF Pro to create a customized comments section with additional fields to my custom post type called Products (it's a simple page with a custom comment section, NOT using WooCommerce).

Now visitors to the website can comment by adding a place where you can buy the product. You can add an image, name, price, link, and country for each product, and it works great.

How it looks, (please ignre the random data inside, just for testing purpose):

What I want is to be able to sort or filter those comments, by adding a select form with options that will make users able to sort the comments by the country field. If they select the UK option in select form, then the first comments should be the ones containing 'UK' in the country field.

Can anybody help me with this?

Much appreciated!

I use ACF Pro to create a customized comments section with additional fields to my custom post type called Products (it's a simple page with a custom comment section, NOT using WooCommerce).

Now visitors to the website can comment by adding a place where you can buy the product. You can add an image, name, price, link, and country for each product, and it works great.

How it looks, (please ignre the random data inside, just for testing purpose): https://ibb.co/zh0rWf9

What I want is to be able to sort or filter those comments, by adding a select form with options that will make users able to sort the comments by the country field. If they select the UK option in select form, then the first comments should be the ones containing 'UK' in the country field.

Can anybody help me with this?

Much appreciated!

Share Improve this question edited Mar 11, 2021 at 20:44 fuxia 107k38 gold badges255 silver badges459 bronze badges asked Mar 11, 2021 at 20:15 AleksandarAleksandar 1 1
  • Welcome to the WordPress DEvelopment Stack exchange. We focus on WordPress development here rather than the support of third-party plugins. You might find better help on the AFC Pro support page. If you have not done so yet, consider checking out the tour and help center to find out how things work here. – Matthew Brown aka Lord Matt Commented Mar 13, 2021 at 9:53
Add a comment  | 

1 Answer 1

Reset to default 0

I would use an url parameter to define which products are shown, and update the page contents either by javascript or php.

本文标签: Custom sort comments with select form