Forum Replies Created

Viewing 15 replies - 16 through 30 (of 48 total)
  • Thread Starter senyoraangelica

    (@senyoraangelica)

    I am writing the code from a pod page:
    https://www.ads-software.com/plugins/pods/
    Is that what you mean?

    <?php if(isset($_GET['title'])) echo "checked='checked'"; ?> works if I remove the <?php echo do_shortcode('[expand] and [/expand]'); ?>

    So I guess it doesn’t work inside do_shortcode? How do I get it to work?

    Thread Starter senyoraangelica

    (@senyoraangelica)

    Hello! Please see my code excerpt from the first post. I don’t know but you may have missed it when I was editing it before you replied?

    Thread Starter senyoraangelica

    (@senyoraangelica)

    Just to clarify, is echo $pod->filters() exactly the same as the following code?

    <form action="" method="get" class="pods-form-filters pods-form-filters-books" action>
        <input type="hidden" name="type" value="books">
    	<input type="text" class="pods-form-filters-search" name="search" value="">
        <input type="submit" class="pods-form-filters-submit" value="Search">
    </form>

    I inserted my checkboxes inside and everything seems to be working fine now but I’d rather not miss anything important that may cause problems in the future.

    Thread Starter senyoraangelica

    (@senyoraangelica)

    Nevermind. I think I figured it out. ??

    Thread Starter senyoraangelica

    (@senyoraangelica)

    Okay, okay, I admit it was naive and dumb of me to assume that my checkboxes would somehow magically merge with the form from filters. lol

    How do I add my checkboxes inside echo $pod->filters() ? Is there another way I could echo filters so that I can manually put my checkboxes in?—so that my checkbox values would also get submitted via the search submit button? I would extremely appreciate your advice. =D

    Thread Starter senyoraangelica

    (@senyoraangelica)

    Thank you! Thank you! Thank you! Thank you!
    Again, I’m extremely grateful for the time and effort you’ve spent in putting up with me! PODS is the best!!!

    Thread Starter senyoraangelica

    (@senyoraangelica)

    Hi Scott!
    I get the same bug even when I use ‘relation’ => ‘AND’
    Debug shows the extra query at the end:

    WHERE ( (book_title.meta_value= 'zero' ) AND (book_author.meta_value= 'zero' ) AND (book_year.meta_value= 'zero' ) AND (t.post_type= "books" ) )

    However, only the search form appears. It doesn’t display any items and searching a word doesn’t do anything.

    Unlike using ‘relation’ => ‘OR’ which returns every item I have regardless of what words I search for, and It also returns an empty pod template at the end of the results.

    Anyway, thank you for all the help. I’m looking forward and hoping for a fix to this bug soon. Keep up the great work!

    Thread Starter senyoraangelica

    (@senyoraangelica)

    Same thing. Only the search form appears. Doesn’t display any items and searching doesn’t work.

    Thread Starter senyoraangelica

    (@senyoraangelica)

    Thank you!!!

    Thread Starter senyoraangelica

    (@senyoraangelica)

    Hi! I’m really sorry but it didn’t work. Now, only the search form appears. It doesn’t display any items and searching a word doesn’t do anything.

    Thread Starter senyoraangelica

    (@senyoraangelica)

    Hello. I’ve been trying really hard but I couldn’t find a solution. Is there a way I can prevent the search from automatically including
    OR ( <code>t</code>.<code>post_type</code> = "books" )
    in WHERE? (This is why the search is returning every item I have?)
    Also, I don’t understand why the code I made above is returning an empty pods template.
    ??

    Thread Starter senyoraangelica

    (@senyoraangelica)

    Hi! Here it is. Thank you again for responding.

    SELECT
                    DISTINCT
                    <code>t</code>.*
                    FROM <code>wp_posts</code> AS <code>t</code>
    
                        LEFT JOIN <code>wp_postmeta</code> AS <code>book_title</code> ON
                            <code>book_title</code>.<code>meta_key</code> = 'book_title'
                            AND <code>book_title</code>.<code>post_id</code> = <code>t</code>.<code>ID</code>
    
                        LEFT JOIN <code>wp_postmeta</code> AS <code>book_author</code> ON
                            <code>book_author</code>.<code>meta_key</code> = 'book_author'
                            AND <code>book_author</code>.<code>post_id</code> = <code>t</code>.<code>ID</code>
    
                        LEFT JOIN <code>wp_postmeta</code> AS <code>book_year</code> ON
                            <code>book_year</code>.<code>meta_key</code> = 'book_year'
                            AND <code>book_year</code>.<code>post_id</code> = <code>t</code>.<code>ID</code>
    
                    WHERE ( ( <code>book_title</code>.<code>meta_value</code> = 'jane' ) OR ( <code>book_author</code>.<code>meta_value</code> = 'jane' ) OR ( <code>book_year</code>.<code>meta_value</code> = 'jane' ) OR ( <code>t</code>.<code>post_type</code> = "books" ) )
    
                    ORDER BY <code>book_year</code>.<code>meta_value</code> DESC, <code>t</code>.<code>menu_order</code>, <code>t</code>.<code>post_title</code>, <code>t</code>.<code>post_date</code>
                    LIMIT 0, 2
    SELECT
                    DISTINCT
                    *, <code>t</code>.<code>ID</code> AS <code>pod_item_id</code>
                    FROM <code>wp_posts</code> AS <code>t</code>
    
                    WHERE ( ( <code>t</code>.<code>ID</code> = 53 ) AND ( <code>t</code>.<code>post_type</code> = "attachment" ) )

    In case you want or need to examine the search form, I have emailed you the url. I sincerely thank you again for all the help.

    Thread Starter senyoraangelica

    (@senyoraangelica)

    Hi! I sincerely thank you for the response and I am extremely grateful for your patience.

    I have edited my code based on your advice but unfortunately, the search form still doesn’t work. Now, the form returns every item I have regardless of what words I search for. It also returns an empty pod template at the end of the results. Here is the code.

    <form method="get" class="" action="">
            <input name="type" value="books" type="hidden">
    
            <input class="" name="search" value="" type="text">
    
            <input class="" value="Search" type="submit">
    </form>
    <?php
    
    $pod_books = pods( 'books' );
    
    $params = array(
        'orderby' => 'book_year DESC',
        'limit' => 2,
        'search' => false,
        'where' => array(
             'relation' => 'OR',
              array(
                 'key' => 'book_title',
                 'value' => pods_var( 'search' ),
              ),
              array(
                 'key' => 'book_author',
                 'value' => pods_var( 'search' ),
    
              ),
              array(
                 'key' => 'book_year',
                 'value' => pods_var( 'search' ),
           )
    ));
    
    echo $pod_books->find( $params )->template( 'book_detail' );
    
    echo $pod_books->pagination();
    
    ?>

    I’m really really sorry to bother you with my problem. And thank you again for the time and effort you’ve spent in putting up with me.

    Thread Starter senyoraangelica

    (@senyoraangelica)

    EDIT: This is the code I’m using, not the code in the first post. Sorry. How do I get this to search my custom fields as well?

    <form method="get" class="" action="">
            <input name="type" value="books" type="hidden">
    
            <input class="" name="search" value="" type="text">
    
            <input class="" value="Search" type="submit">
    </form>
    <?php
    
    $params = array(
        'orderby' => 'book_year DESC',
        'limit' => 2,
    );
    
    $pod_books = pods( 'books' );
    
    echo $pod_books->find( $params )->template( 'book_detail' );
    
    echo $pod_books->pagination();
    
    ?>
    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.

Viewing 15 replies - 16 through 30 (of 48 total)