• Resolved guigarcea

    (@guigarcea)


    <?php

    ? ? $months = [

    ? ? ? ? 'Jan' => 'JAN',

    ? ? ? ? 'Feb' => 'FEV',

    ? ? ? ? 'Mar' => 'MAR',

    ? ? ? ? 'Apr' => 'ABR',

    ? ? ? ? 'May' => 'MAI',

    ? ? ? ? 'Jun' => 'JUN',

    ? ? ? ? 'Jul' => 'JUL',

    ? ? ? ? 'Aug' => 'AGO',

    ? ? ? ? 'Sep' => 'SET',

    ? ? ? ? 'Oct' => 'OUT',

    ? ? ? ? 'Nov' => 'NOV',

    ? ? ? ? 'Dec' => 'DEZ',

    ? ? ];

    $meuArray = api_endpoint('chsa_api_test', 'GetTorneios', array('debug' => false));

    if (empty($meuArray)) {

    ? ? echo "O array está vazio.";

    } else {

    ? ? $painel = array_slice($meuArray, 0, 6);

    ? ? echo "<div class=\"container\">";

    ? ? foreach ($painel as $posicao => $elemento) {

    ? ? ? ? echo "<div class=\"col-md-6 mx-auto\">";

    ? ? ? ? echo "<a href='https://wordpress?ID=" . $elemento['ID'] . "'>";

    ? ? ? ? echo "<div class=\"event card\">";

    ? ? ? ? ? ? echo "<div class=\"datas\">";

    ? ? ? ? ? ? // Exibir data de início e data de término

    ? ? ? ? ? ? $dataObjInicio = new DateTime($elemento['DATA_INICIO']);

    ? ? ? ? ? ? $diaInicio = $dataObjInicio->format('d');

    ? ? ? ? ? ? $mesInicio = $months[strftime('%b', strtotime($elemento['DATA_INICIO']))];

    ? ? ? ? ? ? $dataObjFim = new DateTime($elemento['DATA_FIM']);

    ? ? ? ? ? ? $diaFim = $dataObjFim->format('d');

    ? ? ? ? ? ? $mesFim = $months[strftime('%b', strtotime($elemento['DATA_FIM']))];

    ? ? ? ? ? ? ?if ( ($diaInicio == $diaFim ) && ($mesInicio == $mesFim) ) {

    ? ? ? ? ? ? ? ? ?echo "<div class=\"data-inicio\">" . $diaInicio . "<br><span>" . $mesInicio . "</span></div>";

    ? ? ? ? ? ? }

    ? ? ? ? ? ? else { ?

    ? ? ? ? ? ? ? ? echo "<div class=\"data-inicio\">" . $diaInicio . "<br><span>" . $mesInicio . "</span></div>";

    ? ? ? ? ? ? ? ? echo "<div class=\"data-separator\">a</div>"; ? ? ? ? ?

    ? ? ? ? ? ? ? ? echo "<div class=\"data-fim\">" . $diaFim . "<br><span>" . $mesFim . "</span></div>";

    ? ? ? ? }

    ? ? ? ? ? ? ? ? echo "</div>";

    ? ? ? ? ? ? ? ? echo "<div class=\"descricao\">" . $elemento['DESCRICAO'] . "</div>";

    ? ? ? ? ? ? ? ? echo "<span class='meu-botao'>+</span>";

    ? ? ? ? ? ? ? ? echo "</div>";

    ? ? ? ? ? ? ? ? echo "</div>";

    ? ? ? ? ? ? ? ? echo "</a>";

    ? ? }

    ? ? echo "</div>";

    }

    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @guigarcea

    You shared a code snippet without any additional details. Could you please provide more information about the issue you’re experiencing or how we can assist you?

    While our support doesn’t specialize in creating or fixing custom code snippets, we’re happy to hepl guide you or answer any questions related to the Code Snippets plugin itself.

    Best regards,
    Pau.

    pauserratgutierrez

    (@pauserratgutierrez)

    Hi @guigarcea

    I’m closing this, feel free to re-open

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.