0

I am building a form where a user can submit an article from the front end..

So far so good... To this form i am doing some submission check using javascript..

When i get to check if a category is choosen

This is the line the retrives categories in the form:

<?php wp_dropdown_categories('show_option_none=---------------->&taxonomy=category&hide_empty=0&name=cats[]&orderby=name&hierarchical=1'); ?>

I dont know how to check it.. what is the value being sent to wordpress? Also.. Can i change this:

show_option_none=---------------->

into somthing i can translate using the regular tranlation method aka __() or _e()??

Thanks guys

1 Answer 1

0

Ok... as thing go when your trying to solve somethimg you have no peace until its fixed so.. i went ahead and did some clear mind thinking (after a night sleep) and got that i can check the HTML for the values returen.

Just wanted to share incase anyone stumbles with the need for this info

This:<?php wp_dropdown_categories('show_option_none=---------------->&taxonomy=category&hide_empty=0&name=cats[]&orderby=name&hierarchical=1'); ?>

Returns a value of the category number for each select item which is easy to check.

Also.. about the translation part this is the right way to do that..

<?php 
$choosecatmsg = __('Choose A Category', 'blue_article_demon');                      
wp_dropdown_categories('show_option_none='.$choosecatmsg.'&taxonomy=category&hide_empty=0&name=cats[]&orderby=name&hierarchical=1');
?>

Thanks for anyone who took a look while i was stuck :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.