WordPress.org

Ready to get started?Download WordPress

Forums

Gravity Forms Directory
Filtering Entries With Parameters (14 posts)

  1. vollerworld
    Member
    Posted 1 year ago #

    How can I display results from the directory by filtering with parameters? Let's say I have a date field called "CreatedOn" and wanted to display only those entries created after a certain date. How would I do that?

    http://wordpress.org/extend/plugins/gravity-forms-addons/

  2. Norbert McDorbert
    Member
    Posted 1 year ago #

    Ever get this figured out elsewhere?

    I would like to apply filters as well - doesnt seem able to do custom field filters

  3. jasonhar
    Member
    Posted 1 year ago #

    I'm trying to do the same thing but the questions RE filtering etc never seem to get any attention

  4. AutomatedKid
    Member
    Posted 1 year ago #

    Zack posted this for me but I can't figure out how to implement it. He then vanished into the night not to be seen again. lol

    <?php
    $shortcode = '[directory form="%s" start_date="%s" end_date="%s"]';
    $form_id = '29'; // Replace this
    $start = date('Y-m-d', strtotime('-7 days'));
    $end = date('Y-m-d', time());
    echo do_shortcode(sprintf($shortcode, $form_id, $start, $end));
    ?>

    So, if someone can figure it out, please post back on how to use php in order to filter out the results. I tried the functions.php with no luck.

    And here's the original conversation I had with him....
    link

    I hope someone will respond.

  5. zjat
    Member
    Posted 1 year ago #

    +1

    I would love to find a solution for this and maybe a solution with a permanent link to the filter.

    I would love if I could use the same directory several times on my site.

  6. nascar263
    Member
    Posted 1 year ago #

    Any update on this feature? I am looking for this capability too.

  7. jasonkadlec
    Member
    Posted 1 year ago #

    @AutomateKid - what Zack is telling you to do is to insert that code into your theme.

    My guess is that you have your directory on a page - let's say you called your page "directory" like:

    yoursite.com/directory

    ok - so to get the new code working for you, one suggestion is - make a custom theme file. You're going to need to be able to add a file to your theme - I do this via FTP.

    If you don't know how to edit your theme... you'll need to Google that a little.

    But basically FTP into your theme folder - and see if you have a file called page.php

    If you do, and if this page.php kinda looks something like:

    get_header()

    Some html follows

    some code like: if have posts, while have posts the post:

    the_title();
    Some html
    the_content();
    some more html
    enwhile endif

    get_footer();

    Ok - so if your page.php file has something like my pseudo code above then you're in good shape.

    Copy the page.php to your computer.

    Rename the file page-directory.php and then edit it (using a text editor like Smultron, or WordPad).

    Add Zacks code just below where you see the_content();

    EXCEPT BE SURE YOU CHANGE THE ID OF THE FORM to the ID of the form you want to display as a directory.

    ALSO if you do not see ?> after the content then add it in so your final should be like:

    ..Some HTML and maybe other code...
    the_content(); ?>
    <?php
    $shortcode = '[directory form="%s" start_date="%s" end_date="%s"]';
    $form_id = '29'; // Replace this
    $start = date('Y-m-d', strtotime('-7 days'));
    $end = date('Y-m-d', time());
    echo do_shortcode(sprintf($shortcode, $form_id, $start, $end));
    ?>
    The rest of the HTML and code from this page...

    Basically HTML is HTML, and PHP needs to be inbetween <?php and ?> or <? and ?>

    And once you've done this - upload the newly created page-directory.php to your theme folder.

    Some other ideas for you:

    If you don't have a Developer copy of your site... then best try this out late at night OR create a fake page -- go into your WordPress admin and make a page called

    Fake Page that loads up at http://yoursite.com/fake-page

    now name the file page-fake-page.php instead of page-directory.php

    Now you can muck about until you see it working. Once you do, you should be able to rename the file page-directory.php (or whatever the page your directory lives on is called) - and the new theme file will load in place of page.php - and therefore load in the little extra code Zack gave ya.

    Remember to remove the shortcode you had pasted into your Directory page originally, it's now going to print out below whatever text etc you've saved in the Content Editor of that page -- and yea the directory will just be the last thing on that page - if you want anything else to show below the directory, you'd have to put that below Zack's code in your page-directory.php file.... and if you ever wanted to change it, you'd have to edit that file again.

    No guarantees there are all kinds of ways (like child themes, and template tags and whatnot that could mess it up) - but if you have a simple theme that should work for ya.

  8. nascar263
    Member
    Posted 1 year ago #

    @jasonkadlec - Thank you for the explanation and process steps. I have a better understanding of how to implement a filter into the directory page. I submitted a similar but distinct topic about filtering using user meta fields and user roles. Could you suggest a code I should use for my setup? I provided a detail explanation scenario. Thank you.

    http://wordpress.org/support/topic/advance-filtering-of-directory?replies=2#post-4481989

  9. jasonkadlec
    Member
    Posted 1 year ago #

    @nascar 263 - I don't have bandwidth to think up what the new code would need to be....

    Just google & stack overflow, you'll either find it, or you'll find out how to make it....

  10. AutomatedKid
    Member
    Posted 1 year ago #

    @jasonkadlec - i just wanted to respond and 'thank you' for taking the time to put that together for me, i really appreciate it. i'm going to try and tackle that in the next week or so, i've delayed that part until i can get the site more developed elsewhere, and still have it on my to-do list.

    by chance, if you are a developer and are for hire, i may consider that route as well. i'm starting to hit brick walls, don't have time to learn everything right now, and will need help in the near future. and if you're, by chance, a guru of wp multisite or know someone that is, you had me @ hello! j/k! ;)

    thanks again.

    cheers

  11. jasonkadlec
    Member
    Posted 1 year ago #

    @AutomatedKid - you are welcome! [ redacted ]

  12. @jasonkadlec Please do not use these forums for soliciting work. That's extremely frowned upon and actively discouraged.

  13. jasonkadlec
    Member
    Posted 1 year ago #

    @Jan Dembowski - thanks for the heads up - first time anyone asked me if I'd be open to helping as a contractor.

    What is the acceptable response? To be clear, I was not soliciting, but responding to a request.

  14. Off topic briefly...

    Thanks for that reply, I do appreciate your understanding.

    It's kind of/sort of a gray area.

    Except for plugin and theme authors (when they provide support) email addresses get redacted when found and any soliciting get's zapped too. Also people are encouraged to keep the conversation here as there have been bad cases in the past.

    You were replying but what may have been more acceptable is just posting a link to your site.

    Even that's borderline; like I said it's a gray area. Asking or replying for people to contact you repeatedly can land you into trouble here as well.

    Your intentions are good but please tread carefully.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.