• Resolved Danilo Rodrigues

    (@danilo-rodrigues)


    Hi

    Would it be possible to put a date in the archivesCW via javascript?
    for example

    < script type = “text/javascript” >
    jQuery (document). ready (function ($) {
    $ (‘. calendar-archives ‘) archivesCW ({
    date: <? php get_field (‘ date ‘)? >
    });
    });
    </script>

    I’m using the plugin ACF. And I wanted your plugin grabs the date of my event.
    There is no such possibility in the plugin ArchivesCW?

    Thaks.

    https://wordpress.org/plugins/archives-calendar-widget/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author alek

    (@alekart)

    Hi,
    I don’t understand what you want to do.
    The calendar is built in PHP.
    The jQuery plugin archivesCW do nothing about dates in the calendar, it makes the dropdown work and switching between different months / years (next/prev). The options are: goNext, goPrev, showDropdown, hideDropdown and those are functions to customize animations.

    $ ('. calendar-archives ') archivesCW ({
    date: <? php get_field (' date ')? >
    });

    any PHP code wont work because it is not parsed in PHP and will do JS error.

    Thread Starter Danilo Rodrigues

    (@danilo-rodrigues)

    Ok.
    The calendar appears the date of publication, but I wanted to change that date and place another. There is such a possibility?

    https://drive.google.com/folderview?id=0B6A0OysztWfFNVhwd1R6S2N5Nk0&usp=sharing

    For example change the date 29 to 14 or 13 or 11/13/2015 etc.
    Thanks for your attention.

    Thread Starter Danilo Rodrigues

    (@danilo-rodrigues)

    Your plugin inserts in the calendar the date of posting, and I wanted to put a expecifica date.
    So I did the following way.
    I’m using CPT UI plugin with Advanced Custom Post Type.
    Perfect your plugin.
    Thanks so much for your collaboration. 🙂

    if (!function_exists(‘unigradu_insert_date_event’)) {

    /**
    * Função para iserir a data do evento;
    * No plugin Archive Calendar
    * @param type $data
    * @param type $postarr
    * @return type
    */
    function unigradu_isert_date_event($data, $postarr) {

    if ($data[‘post_type’] === ‘evento’) {

    // Time zone
    date_default_timezone_set(‘America/Sao_Paulo’);

    // Pega a data do evento ex: 20151005
    $date_event = get_field(‘data’, $postarr[‘ID’]);

    // Coloca no formato 2015-10-05
    $date_format = date(‘Y-m-d’, strtotime($date_event));

    // Coloca em um array
    $date_out = explode(‘-‘, $date_format);

    // Pega a hora atual
    $time = date(‘H:i:s’);

    // Colocar a hora atual em um array
    $time_out = explode(‘:’, $time);

    // Instancia de DateTime
    $date_time = new DateTime();

    //$date_out[0] ano
    //$date_out[1] mes
    //$date_out[2] dia
    $date_time->setDate($date_out[0], $date_out[1], $date_out[2]);

    //$time_out[0] Hora
    //$time_out[1] minutos
    //$time_out[2] segundos
    $date_time->setTime($time_out[0], $time_out[1], $time_out[2]);

    $d = $date_time->format(‘Y-m-d H:i:s’);

    // Seta no post_date do php
    $data[‘post_date’] = $d;

    }

    return $data;
    }

    add_filter(‘wp_insert_post_data’, ‘unigradu_isert_date_event’, 99, 2);
    }

    Plugin Author alek

    (@alekart)

    Hi ,
    I did still did not understand why you want to change the date of the posts on the calendar.
    It is the archives calendar so it shows the date that is actually the real date of the post. If you want to show a different date maybe it is easier just to edit the date of the post.

    Btw glad to know you have found a solution but I think that my plugin is not the best solution for whatever you wanted to do.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Colocar data no jquery.archivesCW.min.js’ is closed to new replies.