Form change on post type select

This topic contains 7 replies, has 4 voices, and was last updated by  James Gehring 5 years, 3 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #467201

    James Gehring
    Expired Member
    Post count: 34

    How does the form reload after post type select? I am trying to modify the form with jquery after post type select so I can add some fields in without using the custom fields in the backend.

    When I first change the post type it triggers the onChange code but then the form changes and the items are then gone. I don’t see the page reloading but the form is being changed.

    Is there a filter to modify the form just for a certain post type?

    #467253

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    developers have been alerted about your question and will reply asap.

    Thanks

    #467392

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi James,

    The form is replaced via ajax, there are a few ways to change thins, if you let me know what you are trying to do then i can give you better advice.

    Stiofan

    #467411

    James Gehring
    Expired Member
    Post count: 34

    I am trying to add in my own input field on one of the custom post types and then use _my_geodir_listing_loop_filter to change the query. I have the filter working correctly but can’t get the input field to stay on the form. If I use a custom field and try to override the query it adds in that custom field on top of my custom query. I need to be able to add my own input into the form. I can do it on the form when it is on the custom post type page but if you change the post type selection it reverts the form to the default without my input.

    #467445

    Alex Rollin
    Moderator
    Post count: 27815

    Sorry, to clarify, which form are you talking about. Can you send a screenshot and tell us what/how you want to modify the query? It sounds like the search bar but just want to make sure we are talking about the same thing. Honestly at first I thought it was the add listing form, so, just help us out by clarifying a bit.

    Also, is there a reason you want to do this with V1?
    GDV2 is out of beta.

    #467586

    James Gehring
    Expired Member
    Post count: 34

    It is in the search bar. I have included a screenshot. I want to add an input field into the search bar, but not by adding a custom field. It can be by using a filter or jquery or whatever. I don’t need help modifying the query just getting the field into the search bar. I can do it with Jquery on the custom post type page itself because the form loads for the post type on its own page. The problem is getting the field to show in the form on every page and also when you change the custom post type on the form itself. I know this is a strange request, but the client asked for a way to search that the custom fields don’t really work well with.

    I didn’t use v2 because the site has a lot of customizations and I am not sure if they would work with v2 so I left it the way it is.

    #467674

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    You can use the action

    do_action('geodir_search_form_inputs');

    so something like (not tested)

    
    
    add_action( 'geodir_search_form_inputs', '_my_new_search_input', 15 );
    function _my_new_search_input(){
        global $geodir_search_post_type;
    
        if($geodir_search_post_type=='gd_place'){
            echo '<div class="gd-search-input-wrapper gd-search-field-search"><input class="search_text" name="bla" value="bla bla" type="text" ></div>';
        }
    
    }

    Stiofan

    #467690

    James Gehring
    Expired Member
    Post count: 34

    That worked perfectly. Thanks

Viewing 8 posts - 1 through 8 (of 8 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket