Return a filter form for searching a Pod documented here: https://pods.io/docs/code/pods/filters/
<?php
$pod = pods( 'mypod' );
// Output a filter form with just a text box to search
echo $pod->filters();
// Output a filter form that shows two drop-downs for two relationship fields
echo $pod->filters( array(
'fields' => array( 'pick_field1', 'another_pick' )
) );
// The same as above, except the submit button text says 'Go'
echo $pod->filters( array(
'fields' => array( 'pick_field1', 'another_pick' ),
'label' => 'Go'
) );
// Get the items, search is automatically handled
$pod->find();
// Output the list of the items found
echo '<ul>';
// Loop through items found
while ( $pod->fetch() ) {
echo "<li>" . $pod->display( 'some_field' ) . '</li>';
}
echo '</ul>';
// Add some pagination
echo $pod->pagination();
<?php
//setup Pods object
$pods = pods( 'books');
// set fields to be searched
echo $pods->filters( array(
'fields' => array( 'author'),
) );
// Get the items, search is automatically handled
$pods->find();
//Don't display anything until search is submitted
if ( 0 < strlen( pods_v( 'search' ) ) ) {
//loop through results, using Pods template for display.
while ($pods->fetch()) {
echo $pods->template( 'books_search');
} //endwhile
} //endif