pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.07k stars 264 forks source link

Filter Pods by letter #7028

Open Ca-Lessio opened 1 year ago

Ca-Lessio commented 1 year ago

Problem to Solve

Hi, I’ve created a custom post type with custom fields and I’m using a Pods template to display it in tabular format. This works perfectly, now I would like to be able to filter the results to show, for example I would like to show only posts that have the title starting with the letter A. I have found some code that can do this, example: https://wordpress.stackexchange.com/questions/298888/wp-query-where-title-begins-with-a-specific-letter but I would like to understand how I can adapt this to use it within the Pods plugin ?. Can I write PHP code inside the Pods template editor or do I need to create an archive{custom post type}.php? If you can, could you give me an example…

Proposed Solution

it would be useful to be able to add PHP code in the Pods template editor or have a standard php file for example in the Pods site that you can copy to create an archive(custom_pos_type).php and single.php with an example for all the Pods functions and to view the various values ​​of the custom fields. A kind of guide with demo file to make it easier even if you have less experts (like me )

Possible Workaround

No response

Examples Elsewhere

No response

Screenshots / Screencast

No response

JoryHogeveen commented 1 year ago

@sc0ttkclark The Pods search query isn't searching through metadata. Not sure how this works exactly as I believe it's quite old code but here are some references:

https://github.com/pods-framework/pods/blob/main/classes/PodsData.php#L3444-L3462 https://github.com/pods-framework/pods/blob/main/classes/PodsData.php#L1050-L1054