Add Listing Default Category

This topic contains 5 replies, has 4 voices, and was last updated by  Joy 7 years ago.

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

Open Support Ticket
  • Author
    Posts
  • #399742

    Joy
    Buyer
    Post count: 1076

    Hello, is there a way to have a post type default to a particular category? I have removed the “Category” selector from the “Add Listing” pages and I will be classifying the listings from the dashboard.

    However, upon submitting a listing, I would like a default category applied. Thank you.

    #399868

    Paolo
    Site Admin
    Post count: 31206

    Hi joy,

    it si not possible to remove the category selector from the add listing page, because the category is a mandatory field. What you can do is auto fill the category with jquery and hide the category selector with css.

    https://wpgeodirectory.com/support/topic/autofill-category/

    Let us know how it goes,

    Thanks

    #399869

    Kor
    Moderator
    Post count: 16516

    Hi Joy,

    Unfortunately, this is currently not possible out of the box. Please feel free to add this to our feature request list. https://wpgeodirectory.com/requests/

    Thanks!

    #399893

    Joy
    Buyer
    Post count: 1076

    Thank you! It worked. I did have one more question about it. Maybe @stiofan can chime in.

    Is there a way to simplify this? I would like the default category to be set for each post type(I have 5) instead of being dependent upon the price package(I have 14).

    #399970

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    You can add multiple like this

    
    
    jQuery(document).ready(function(){
    
    $price_id = jQuery('[name="package_id"]:checked').val();
    
    if($price_id==3 || $price_id==4 || $price_id==10){
    jQuery('#gd_placecategory.chosen_select').val('8').change();
    }
    
    });

    Or if its all the one CPT you can just use

    
    
    jQuery(document).ready(function(){
    
    jQuery('#gd_placecategory.chosen_select').val('8').change();
    
    });

    Stiofan

    #399982

    Joy
    Buyer
    Post count: 1076

    Perfect. Thank you very much.

Viewing 6 posts - 1 through 6 (of 6 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