• Super User

    Calendario eventi con data dell'evento e non dell'articolo

    Salve a tutti,
    fino ad oggi ho usato il seguente widget (code . garyjones . co . uk/plugins/calendar-category) per la visualizzazione del mio calendario di eventi.

    Così come altri widget, esso mostra la data in cui l'articolo è stato reso pubblico sul sito.

    Io invece vorrei pubblicare oggi un articolo per un evento che inizierà ad esempio giorno 1 dicembre, quindi sul calendario dovrà essere evidenziato giorno 1 dicembre e non la data odierna.

    Sapreste indicarmi un widget che possa avvicinarsi alla mia necessità?

    Grazie.


  • Super User

    Nessun suggerimento? 😞


  • Super User

    Soluzione trovata, ho usato la combinazione di due plugin:

    • Calendar Category (wordpress . org/plugins/calendar-category/)
    • No future Posts (wordpress . org/plugins/no-future-posts/)

    Il primo mi permette di visualizzare in un Widget con Calendario i Posts di una categoria.
    Il secondo mi permette di rendere pubblici anche i Posts con una data futura rispetto a quella attuale.

    E' stato effettuato il seguente HACK nel primo plugin (come segnalato da un altro utente):

    
    // Get days with posts
    $sql = "SELECT DISTINCT DAYOFMONTH(post_date)
              FROM $wpdb->posts " . calcat_maybe_single_category_joins( $category ) . "WHERE MONTH(post_date) = '$thismonth'
              AND YEAR(post_date) = '$thisyear'" . calcat_maybe_single_category_cat( $category ) . "
              AND post_type = 'post' AND post_status = 'publish'
             AND post_date < '" . current_time( 'mysql' ) . '\'';
    
    

    a

    
    $sql = "SELECT DISTINCT DAYOFMONTH(post_date)
              FROM $wpdb->posts " . calcat_maybe_single_category_joins( $category ) . "WHERE MONTH(post_date) = '$thismonth'
              AND YEAR(post_date) = '$thisyear'" . calcat_maybe_single_category_cat( $category ) . "
             AND post_type = 'post' AND post_status = 'publish'";
    
    

    (è stata rimossa l'ultima riga!).

    Adesso sul calendario sono presenti anche i POSTS con data futura.

    Risolto.

    Grazie comunque! 😉