WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is my code:

var hideweek;
var day;
var cloDays = new Array();
function initdatepicker(hideweek){

    var splitWeek = hideweek.split("&&");

    $.each( splitWeek, function( skey, svalue ) {
        cloDays[skey] = svalue;

        dateFormat: 'mm-dd-yy',
        showOn: "button",
        buttonImage: "<? bloginfo('template_directory') ?>/images/cal.png",
        buttonImageOnly: true,
        minDate: 0,
        beforeShowDay: function(date) {
            day = date.getDay();<br/>
            return [(day !=1 && day !=2)];

On ajax response I called this function 'initdatepicker' with parameter (1&&3&&5). Here 1, 3 and 5 are week days number which I don't want to show. So I split the string (hideweek) and stored in array (cloDays).

Now I need to make this portion of code dynamic.

##     return [(day !=1 && day !=2)];
share|improve this question
Please reformat/edit your question and use the WYSIWYG buttons for code formatting. – kaiser Sep 4 '13 at 16:09
Hey Kaiser, sorry for formatting issue, posting on stackexchange for first time.Can you review code now? – Aman Saxena Sep 4 '13 at 16:57
Aman, not really. Use tabs or 4spaces per tab to intent stuff properly. Also fix that headline please. Hint: There's also the help center. – kaiser Sep 4 '13 at 17:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.