• Resolved 00lessio

    (@00lessio)



    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…

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @00lessio

    How are you displaying the posts exactly? Are you using auto-templates or a fully customized Pods template?

    When using auto templates you can simply filter the WP_Query and it will work. Pods is merely the displaying part, not the query.

    If you use a Pods shortcode or block to display a customized template then you’ll need to create filters for this in which you modify the “where” tag.
    See documentation:
    https://docs.pods.io/displaying-pods/pods-shortcode/
    – Filter: https://github.com/pods-framework/pods/blob/main/includes/general.php#L1397

    Note that the shortcode itself also has a filters param. It can filter the results based on taxonomies or relationships and can also include a search bar.

    Cheers, Jory

    Thread Starter 00lessio

    (@00lessio)

    hi @keraweb , thanks for the answer. I created a custom template in the appropriate section of the Pods plug-in, then I also enabled the automatic template but to view the table I use the list block on another page by selecting the template I made. now I have enabled the search bar with the tick present in the Pods list block but it searches only among the titles, instead I wanted to understand if I can use that Pods search bar also to search among the custom fields thus maintaining the same personalized template and the basic one of wordpress. could you give me an example of filter for letter “A” … , I want to make a page with a Tab inside for each letter of the alphabet with a table inside (my custom template) for today Tab showing all my posts custom post types starting with that letter. I was thinking of making an HTML block or directly a plug-in to tap on the wordpress page and insert a pods block in each Tab, each with a different letter filter. I hope I was clear unfortunately I don’t speak English well, I checked the documentation but I can’t quite understand how to use it for my problem, I hope you can help me with some examples, thanks

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @00lessio

    I see you’ve also posted this on GitHub. Please reply there as I’ll do the same.

    Closing topic here!

    Cheers, Jory

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Filter Pods by letter’ is closed to new replies.