Tell us what you are trying to do?
I am creating a view filter. I have a custom Number field called rating. Now in the filter I set the condition Greater than or equal to. I have one post and it has 4.1 rating. Now in the front end if I put 4 in the search box and search, the view shows the post. But if I put 4.1 in the search box and search, the view doesn't show the post.
Is there any documentation that you are following?
This function will change the comparison type to 'decimal' for the field with slug 'property-rating', in all views.
( you'll change the 'property-rating' with the slug of the field used on your website )
I hope this helps and please let me know if you need further assistance.
> 1. The slug of my Number Custom Field is 'rating'. Do I need to change 'wpcf-property-rating' to 'wpcf-rating' in the code?
- The prefix 'wpcf-' is appended to all the custom fields registered through the Toolset Types plugin.
So, if in the field's settings, you have set the slug to 'rating', in the code, you'll use 'wpcf-rating'.
> 2. Do I need to change anything else in the code? I found 'wpcf-property-rating' just once in the code.
- Yes, there is just one instance of this field slug that you need to change in the code.
> 3. Also should I close the php in my newly created Custom Code Rating.php?
- No, you don't have to include the closing PHP tag.
> 4. Also can you kindly tell me what are Run context: Front-end , WordPress admin & AJAX calls. I tried switching them on and off to see the effect on the result . But I couldn't find any effect.
- The "Run context" determines where a particular code snippet is included for execution.
a). Front-end: when any frontend page/post is viewed/rendered
b). WordPress admin: when any backend or admin area page/section is viewed/rendered
c). AJAX calls: when any AJAX call is made by the WordPress
For this particular code snippet, you can keep all 3 contexts enabled.
I hope this explanation helps and let me know how it goes.