Default Category (repeat)

This topic contains 8 replies, has 3 voices, and was last updated by  Guust 6 years ago.

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

Open Support Ticket
  • Author
    Posts
  • #428341

    James Hill
    Lifetime Member
    Post count: 42

    This topic was closed so I had to repost. I used the Jquery code to set a default category to the single one I am using, #18. For some reason it will not toggle the value to checked. I used the code provided in https://wpgeodirectory.com/support/topic/set-default-category/ and just changed the category number to the one used on my site. I had to put to code in the footer as the header made the Google Map go away. That is telling, must be a conflict but I don’t see anything in the console. Any ideas?

    
    
    <script>
    
    jQuery(document).ready(function(){
        
        if(location.pathname == "/add-listing/")
        {
                jQuery('#gd_placecategory.chosen_select').val('18').change();
                setTimeout(function()
                {
                    jQuery('input[name = post_default_category][value = 18]').attr("checked", "checked");
                }, 2000);
      
        }
    
    });
    
    </script>
    #428349

    Guust
    Moderator
    Post count: 29970

    Please post you URL and WP admin details in a private reply so we can have a look. Thanks

    #428533

    James Hill
    Lifetime Member
    Post count: 42
    This reply has been marked as private.
    #428552

    Guust
    Moderator
    Post count: 29970
    This reply has been marked as private.
    #428577

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    The field was set to Ajax chained, but, was not loading that UI; it seems that value was being cached.

    Resaving the field settings brought the UI back and the snippet works now.

    Please try it and let us know

    #428603

    James Hill
    Lifetime Member
    Post count: 42

    Thanks, it is almost there. It now shows as the category selected by default, “Set Tributes as default category.” Works, kind of, see the screen shot.

    #428605

    Guust
    Moderator
    Post count: 29970

    Hide the category row with CSS if you like. Thanks

    #428606

    James Hill
    Lifetime Member
    Post count: 42

    Perfect, that makes sense. Thanks for your help on this.

    #428624

    Guust
    Moderator
    Post count: 29970

    You’re welcome 🙂

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

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

Open Support Ticket