• Resolved senyoraangelica

    (@senyoraangelica)


    I tried this code

    <?php
    
    $pod = pods( 'books' ); 
    
    echo $pod->filters( array(
     'fields' => array( 'book_title', 'book_author', 'book_genre' )
    ) ); 
    
    $pod->find(); 
    
    while ( $pod->fetch() ) {
        echo "<li>" . $pod->display( 'book_title' ) . '</li>';
    }
    
    echo '<ul>'; 
    
    echo $pod->pagination();
    
    ?>

    It shows the search form with the search button but it is missing the filter dropdown for my custom fields. Is my code wrong?

    The following code should display a dropdown menu containing my custom fields, right?

    echo $pod->filters( array(
     'fields' => array( 'book_title', 'book_author', 'book_genre' )
    ) );

    http://wordpress.org/plugins/pods/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    Filters currently only supports relationship fields (drop-downs). Are Book Title / Book Author / Book Genre relationship fields or are they single line text fields?

    Thread Starter senyoraangelica

    (@senyoraangelica)

    They are plain text fields. Reading through the forums, if I understand correctly, a Relationship field type is for linking different pods together?

    Is there a shortcode or something in the pods codex that would let me display my custom fields as tick boxes or dropdowns right beside the search form? Or is writing my own custom code the only way I can do this?

    I want to let visitors search my pod items through a custom field of their choice. Using the code above, the search form doesn’t find texts from my other custom fields. It only finds texts on my pods item title.

    Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    Pods doesn’t allow for any other filters than relationships right now, beyond that, there’s a single text field that will do a basic text search.

    You can always build your own filter form that can do anything your heart desires with PHP, and during processing, pass your search directly into a find() call, or you can use WP_Query meta_query if you’re using Post Types.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Filters dropdown not showing’ is closed to new replies.