• Resolved birken

    (@birken)


    i have listings and i am using the form for claiming the listing, Now if the listing is claimed how can i hide the form on that page id?
    Regards B

    • This topic was modified 1 year, 8 months ago by birken.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Saurabh – WPMU DEV Support

    (@wpmudev-support7)

    Hi @birken

    If you need to hide the form using the page id, you can get the info from the classes added to the body element and then hide it by using JQuery, please find a code sample below (for a page id = 2 and Forminator module = 665 example):

    (function($) {
    	
      $( document ).ready(function() {
    
       if ($( "body" ).hasClass( "page-id-2")) {
    
          $( "#forminator-module-665" ).hide();
    
       }
    
    });
    	
    })( jQuery );

    It would be recommended to look for another element in the individual items of the listing though, so it could be used as a criteria to hide the form (any hidden field that shows an item has been claimed for instance), otherwise, it may be necessary to add the page id’s manually.

    Hope this information helps. Let know if additional assistance may be required.

    Kind regards

    Luis

    Thread Starter birken

    (@birken)

    Super thx for you quick response, if i understand right with that code i need to add new page id every time i want to hide the form on a listing page right?

    sorry i dont understand this answer: It would be recommended to look for another element in the individual items of the listing though

    Regards B

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @birken

    Thanks for response!

    sorry i dont understand this answer: It would be recommended to look for another element in the individual items of the listing though

    The code example that my colleague shared depends on the “general” CSS class of the given page. So it does not see if the listing has been claimed really or not and yes – you would need to edit that code each and every time you know listing is claimed. Edit by adding yet another class.

    The better way would be to use CSS class of some other element of the page. Such element should be “unique” for pages that show claimed listing but not other listing.

    For example, let’s say that “claimed” pages have the message on top that says “Listing claimed” and if you inspect that message with browser “inspect” tool, you find out that the HTML of that message is like this:

    <span class="listing-claimed">Listing claimed</span>

    then you can modify the code and use the .listing-claimed class in it, like this:

    (function($) {
    	
      $( document ).ready(function() {
    
       if ($( "body" ).hasClass( "listing-claimed")) {
    
          $( "#forminator-module-665" ).hide();
    
       }
    
    });
    	
    })( jQuery );

    This way you wouldn’t need to edit the code manually each time. It would automatically work on each and every page that contains that “listing claimed” message.

    That said, I’m not sure if there is such class that you can use. We can take a look and see if we could help but you would need to share direct links to example pages:

    – at least one of claimed listing
    – and at least one of not claimed listing

    so we could take a look and compare them to see if we can identify such unique element/class there.

    Best regards,
    Adam

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @birken ,
    ?
    We haven’t heard from you for several days now, so it looks like you no longer need our assistance.
    ?
    Feel free to re-open this ticket if needed.
    ?
    Kind regards
    Kasia

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘hide a form with page id?’ is closed to new replies.