Support » Plugin: Custom Content Type Manager » [Plugin: Custom Content Type Manager] datepicker regional

  • Resolved heike-carle



    I use CCTM for a client project where several dates could be chosen in custom fields with a localized datepicker (I just added datepicker-de.js in date.php to be enqueued); that worked perfect until I updated from version
    With CCTM 0.9.6. there is no chance to get a regional datepicker.js (-de or whatever) enqueued, or did I miss something? Is there a way to get back a datepicker that uses another than english language?

    I’m wondering which datepicker.js is loaded while editing a custom post: I tried to overwrite the names of day, months etc. to check this, but this overwrites aren’t shown, even when I empty all chaches.
    Acc. to Firebug, datepicker (and the whole jquery.ui) is loaded from within wp-admin, but that would be too strange, or?

    B.t.w., Firebug notes a missing js-file (datetime.js), which is still enqueued via date.php.

    I’m a bit confused and would appreciate any help on this.
    Thanks, Heike

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor fireproofsocks


    Yeah, the datetime.js file got sniped by the kind folks at WP because my slaughtering of the original shoddy code did not divorce it enough from its creative commons roots, so they pulled the plugin for “licensing violations”. That kind of policing thing irks me no end, but I digress…

    I’m not sure what to tell you… the date fields have always relied on the built-in jquery.ui, I just loaded up the approved jQuery plugin for the date selector: it’s in js/datepicker.js — I specifically went that route because jQuery had already done the localization work.

    Note that the files that each field loads up are specified in the admin_init() function for each field, e.g. the fields/date.php file features this:

    wp_enqueue_script( 'jquery-ui-datepicker', CCTM_URL . '/js/datepicker.js', 'jquery-ui-core');

    You can try playing around with that file and loading up the variations you require. Actually, you can COPY this file into wp-content/uploads/cctm/fields/ and your copy in that location should override the copy that ships with the CCTM, so you’d safeguard yourself from any trouble with upgrading. See for more info.

    Thank you for your early reply.
    I can understand your trouble very well, licensing and terms of licenses sometimes make me want to tear my hair out!

    But let’s keep to the point… I followed your hints and copied the old-style date.php (cctm to put it in wp-content/uploads/cctm/fields/ for I don’t need no timepicker or date and time.
    The regional datepicker-de.js (a list of regionals provided on googlecode) is now in a js-folder of the child-theme I use for that site and enqueued like this:
    wp_enqueue_script( 'jquery-ui-datepicker-de', get_stylesheet_directory_uri() . '/js/datepicker-de.js', 'jquery-ui-core');
    So this additional js-file should be safe when updating cctm, too.
    Everything works like a charm, hopefully this was the right way and not causing troubles somewhere else. đŸ˜‰

    Some dates in custom posts were already english, thus I had to look for them and changed all manually via phpMyAdmin in the meta_value of the database.

    Deeply grateful for your efforts,

    Plugin Contributor fireproofsocks


    Glad that worked. I’m sure there will be other people in the same situation… I’m wondering if there’s an easier way to localize the date fields…

    Localization of jquery ui effects seems to work that way, and it makes sense to add a regional js-file, which just overwrites the defaults (of course english). The CCTM outputs (date formats) are quite easy to understand and one can write one’s own date format, so it’s comfortable as long as you don’t need the newly included timepicker and that datetime.js for there is no “translation” available as far as I found out.

    The whole localization thing with WordPress is tricky: Even when there are translations for theme’s or plugin’s (and I mean the output acc. i18n, so that .mo and .po language-files can do their working parts), you’re never sure if everything will be updated with the theme or plugin itself.

    I’m not developer enough to know much of their hassle and localization surely doesn’t make things easier for them, so I don’t wanna be misunderstood: I’m not beefing about, I’m just looking for solutions and a way to get things working.
    A recommendation from the Codex:

    To translate a date, e.g. inside your plugin, use mysql2date() or date_i18n(). Your date will be returned in localized format, based on the timestamp.

    But I doubt if this touches tools like datepicker. You might know better than me …

    Plugin Contributor fireproofsocks


    The problem here is that the translation functions are in PHP, and the jQuery plugins are Javascript… it’s easy enough to translate date values, but all the labels (months, day names, etc) on the actual pop-up are all handled by Javascript… it’s worth looking into further…

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Custom Content Type Manager] datepicker regional’ is closed to new replies.