Hide #gd_placecategory_row in the add listing form

This topic contains 15 replies, has 3 voices, and was last updated by  Giri 7 years, 6 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #377851

    clem
    Buyer
    Post count: 87

    Hi,

    I’m trying to hide the category selector in the add place form ONLY FOR SOME PRICE PACKAGES.

    I already had this fonction to create a different class for each packages :

    // add the package id to the body
    add_filter( ‘body_class’, ‘my_add_package_class’,10,1 );
    function my_add_package_class($class){
    global $post;
    if (geodir_is_page(‘detail’) && isset($post->package_id)) {
    $class[] = “gd-package-id-“.$post->package_id;
    }
    return $class;
    }

    (I know it works because I’m using this classes for hiding something else)

    I added this CSS :

    .gd-package-id-10 #gd_placecategory_row {
    display: none;
    }

    But doesn’t work and no idea what’s wrong on it.

    As it is a customisation I can paye if someone find the solution 🙂

    Just for information, I want to hide it for some packages because they have only 1 category and I did an automatique selection

    Here is the code I added to the “Footer script code” (works perfectly):

    jQuery(document).ready(function(){

    if(location.pathname == “/add-listing/”)
    {
    $price_id = jQuery(‘[name=”package_id”]:checked’).val();

    if($price_id == 1)
    {
    jQuery(‘#gd_placecategory.chosen_select’).val(’68’).change();
    setTimeout(function()
    {
    jQuery(‘input[name = post_default_category][value = 68]’).attr(“checked”, “checked”);
    }, 2000);

    }

    Thanks in advance !

    Clem

    #377945

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    the function for the body class only works for details pages because of this:

    if (geodir_is_page(‘detail’)

    It doesn’t work for the add listing page.

    I asked to the developers to provide the code to make it work in the add listing page too.

    Thanks

    #378004

    clem
    Buyer
    Post count: 87

    Ok I understand now

    I’m waiting for the solution

    Thanks again Paolo !

    #378941

    clem
    Buyer
    Post count: 87

    Hi Paolo

    Just to know if you had some information from the developers about this piece of code ?

    Thanks

    Clem

    #379019

    Paolo
    Site Admin
    Post count: 31206

    I reminded them about your question.

    Thanks for your patience

    #379080

    Giri
    Expired Member
    Post count: 3155

    Hi clem,

    Try changing

    geodir_is_page('detail')

    with

    geodir_is_page('add-listing')

    Let me know how that goes.

    Thanks

    #379363

    clem
    Buyer
    Post count: 87

    Hi Giri,

    Thanks for your answer, I did some tests and apparently it doesn’t work 🙁

    #379476

    Giri
    Expired Member
    Post count: 3155

    Hi clem,

    In that case post your login credentials. I’ll take a look.

    Thanks

    PS: Provide the location for the current snippet

    #379618

    clem
    Buyer
    Post count: 87
    This reply has been marked as private.
    #379659

    Giri
    Expired Member
    Post count: 3155
    This reply has been marked as private.
    #379668

    clem
    Buyer
    Post count: 87
    This reply has been marked as private.
    #379868

    Giri
    Expired Member
    Post count: 3155

    Everything in your code is correct except this part.

    $class[] = "gd-package-id-".$post->package_id;

    It should be

    $class[] = "gd-package-id-".$_REQUEST['package_id'];

    Please make sure you are using the correct quotes in code while copy and pasting.

    #379872

    clem
    Buyer
    Post count: 87

    I did it right away but still not working 😔

    // add the package id to the body
    add_filter( ‘body_class’, ‘my_add_package_class_add_listing’,10,1 );
    function my_add_package_class_add_listing($class){
    global $post;
    if (geodir_is_page(‘add-listing’) && isset($_REQUEST[‘package_id’])) {
    $class[] = “gd-package-id-“.$_REQUEST[‘package_id’];
    }

    return $class;
    }

    The credentials I gave you are still valid in case you want to have a look …

    Thanks anyway !!

    #379983

    Giri
    Expired Member
    Post count: 3155
    This reply has been marked as private.
    #380014

    clem
    Buyer
    Post count: 87

    Giri you’re a genius ! 😃

    It works perfectly now

    Thank you very much …

    After 9 months work I will launch the site very soon, I will let Geodirectory know

    I will buy 3 other add-ons for my next version (stripe – GD business hours – GD related post ) for the next version

    Clem

Viewing 15 posts - 1 through 15 (of 16 total)

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

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount