让 jQuery Datepicker 兼容 WordPress 和 WPML

没什么好说的,直接代码:

jQuery(function($){
        $.datepicker.regional['zh-hans'] = $.datepicker.regional['zh_CN'] = {
                closeText: '关闭',
                prevText: '<上月',
                nextText: '下月>',
                currentText: '今天',
                monthNames: ['一月','二月','三月','四月','五月','六月',
                '七月','八月','九月','十月','十一月','十二月'],
                monthNamesShort: ['一','二','三','四','五','六',
                '七','八','九','十','十一','十二'],
                dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
                dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
                dayNamesMin: ['日','一','二','三','四','五','六'],
                weekHeader: '周',
                dateFormat: 'yy-mm-dd',
                firstDay: 1,
                isRTL: false,
                showMonthAfterYear: true,
                yearSuffix: '年'};
        $.datepicker.setDefaults( $.datepicker.regional[ "<?php echo defined('ICL_LANGUAGE_CODE')?ICL_LANGUAGE_CODE:WPLANG;?>" ] );
});

最后一行,这儿由于 WPML 和 WORDPRESS 的语言静态变量不一样,值也不同,需要判断然后输出,输出的值可能是 zh-hans,或 zh_CN,所以在第一行声明了两个变量来存储翻译。

1,481 thoughts on “让 jQuery Datepicker 兼容 WordPress 和 WPML

  1. What Equipment is Needed for Sling TV

    I know this if off topic but I’m looking into starting
    my own blog and was curious what all is needed to get set
    up? I’m assuming having a blog like yours would cost
    a pretty penny? I’m not very web savvy so I’m not 100% certain. Any suggestions or advice would be
    greatly appreciated. Cheers

  2. pdf repair manuals for bike

    Hey! I’m at work surfing around your blog
    from my new iphone! Just wanted to say I love
    reading your blog and look forward to all your posts! Carry on the outstanding work!

  3. Quest Bars Cheap

    Undeniably believe that which you said. Your favorite justification appeared to be on the web the simplest thing to be aware
    of. I say to you, I definitely get irked while people think about worries that they
    just don’t know about. You managed to hit the nail upon the top and
    also defined out the whole thing without having side effect , people can take a signal.

    Will probably be back to get more. Thanks

  4. quest bars cheap

    I am really thankful to the owner of this web site who has shared this
    great piece of writing at here.

  5. Health Benefits of Coconut Oil

    I’m no longer sure where you’re getting your information, however great topic.
    I needs to spend some time learning much more or figuring out more.

    Thank you for excellent info I was looking for this info for my mission.

  6. Drugs-Depot.Com Coupon Codes

    I don’t even know how I ended up here, but I thought this post was great.

    I do not know who you are but certainly you are going to a famous blogger if you aren’t already 😉 Cheers!

  7. minecraft secret free download

    Do you mind if I quote a couple of your articles as long as I provide credit and sources back to your weblog?

    My blog is in the exact same area of interest as yours and my users would really benefit from a lot of the information you present here.
    Please let me know if this alright with you.

    Appreciate it!

Comments are closed.