Support » Plugin: WPAdverts - Classifieds Plugin » Hide category

  • Resolved teeboy4real

    (@teeboy4real)


    Hello,

    Im using preselect ad category feature how can I hide or remove a category option from the category dropdown list.

    Example
    My categories are:

    Cars
    Bikes
    Premium ads (I want to hide this category option from the dropdown list)
    Boats
    Bicycle

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    are you using the Preselect Ad Category snippet or the functionality bundled in the Custom Fields extension?

    If the functionality from Custom Fields extension then right now the only option to do that is to open file wpadverts-custom-fields/inlcludes/class-taxonomies-integration.php find function display(), inside it find code

    
    $terms = get_terms( 'advert_category', array( 
        'hide_empty' => 0,
        'parent' => 0,
    ) );
    

    and change it to

    
    $terms = get_terms( 'advert_category', array( 
        'hide_empty' => 0,
        'parent' => 0,
        'exclude' => 100
    ) );
    

    where 100 is an actual ID of the “Premium ads” category.

    If you are using the snippet then you will need to make the same change as above but in function preselect_ad_category_display() in file preselect-ad-category/preselect-ad-category.php.

    Thread Starter teeboy4real

    (@teeboy4real)

    is this meant to be ‘exclude’ => 100 or ‘exclude’ => 100, with a coma at the end

    I tried the two but it did not work

    Please note that im using DTD and preselect category snippets

    Plugin Author Greg Winiarski

    (@gwin)

    It can be with or without coma at the end, it makes no difference (as long as there are no additional parameters below), however, the 100 should be changed to the ID of your category.

    To make the snippet work with DTD as well, open the dependant-taxonomy-dropdown.php file find function dependant_taxonomy_dropdown_taxonomies() and before line

    
    $terms = get_terms( $taxonomy, $args );
    

    add

    
    $args["exclude"] = 100;
    

    where again 100 is the ID of the category you want to exclude.

    Thread Starter teeboy4real

    (@teeboy4real)

    Thanks this worked perfectly, this issue is now resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.