Commit aad34b2e authored by numeroteca's avatar numeroteca

#10 arregla selección y comparativa de fechas en actividades

parent e7a2280f
......@@ -12,8 +12,8 @@ $prefixact = '_act_';
$tit = get_the_title();
$place = get_post_meta( $post_id, $prefixact.'place', true );
$time = get_post_meta( $post_id, $prefixact.'time', true );
$dateinit = get_post_meta( $post_id, $prefixact.'date-init', true );
$date = DateTime::createFromFormat('m/d/Y', $dateinit);
$date = get_post_meta( $post_id, $prefixact.'date-init-fix', true );
// $date = DateTime::createFromFormat('m/d/Y', $dateinit);
$dateinit2 = get_post_meta( $post_id, $prefixact.'date-init2', true );
$dateend = get_post_meta( $post_id, $prefixact.'date-end', true );
$organizer = get_post_meta( $post_id, $prefixact.'organizador', true );
......@@ -70,7 +70,7 @@ $the_content = get_the_content();
// if ( $tit!= '' ) echo __('What','colormag-child').": ".$tit."<br>";
if ( $place != '' ) echo __('Place','colormag-child').": ". $place."<br>";
if ( $time != '' ) echo __('Hour','colormag-child').": ".$time."<br>";
if ( $dateinit != '' ) echo __('Start date','colormag-child').": ". date_format($date, 'D, d/m/Y'). "<br>";
if ( $date != '' ) echo __('Date','colormag-child').": ". date("d/M/Y", strtotime($date)). "<br>";
if ( $dateend!= '') echo __('End date','colormag-child').": ".date( 'd/M/Y', $dateend )."<br>";
echo __('Type','colormag-child').": ". get_the_term_list( $post->ID, 'tipo-actividad', ' ', ', ', '' )."<br>";
echo __('Organized by','colormag-child').": ". $organizer."<br>";
......
No preview for this file type
......@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: wikitoki\n"
"POT-Creation-Date: 2015-02-18 23:24+0100\n"
"PO-Revision-Date: 2020-01-09 14:05+0100\n"
"PO-Revision-Date: 2020-01-29 15:01+0100\n"
"Last-Translator: pablo <pablo@basurama.org>\n"
"Language-Team: wikitoki <info@wikitoki.org>\n"
"Language: es\n"
......@@ -765,6 +765,12 @@ msgstr "Volver a Quiénes somos"
msgid "Authorship"
msgstr "Autoría"
msgid "Blog"
msgstr "Blog"
msgid "Date"
msgstr "Fecha"
#~ msgid "Activities spacious"
#~ msgstr "Archivo de actividades pacious"
......
......@@ -30,14 +30,15 @@ get_header(); ?>
$args = array(
'post_type' => 'actividad', //sets post type to actividad
'meta_key' => '_act_date-init',
'meta_key' => '_act_date-init-fix',
'orderby' => 'meta_value_num',
'order' => 'DESC',
'posts_per_page'=> -1,
'meta_query' => array(
array(
'key' => '_act_date-init',
'value' => time(),
'key' => '_act_date-init-fix',
'value' => date('Y-m-d'), // if nothing is seet it uses time() as date. It is transformed to Y-m-d format
'type' => 'DATE',
'compare' => '>=', //for today or in the future
),
),
......@@ -69,20 +70,21 @@ get_header(); ?>
<!-- Activities archive --------------------------- -->
<?php //Loop through Actividades
// Prepares the query
$args = array(
'post_type' => 'actividad', //sets posts type
'meta_key' => '_act_date-init',
'orderby' => 'meta_value_num',
'order' => 'DESC',
'posts_per_page'=> -1, // put -1 to show them all
'meta_query' => array(
array(
'key' => '_act_date-init',
'value' => time(),
'compare' => '<', //before today
),
),
);
$args = array(
'post_type' => 'actividad', //sets post type to actividad
'meta_key' => '_act_date-init-fix',
'orderby' => 'meta_value_num',
'order' => 'DESC',
'posts_per_page'=> -1,
'meta_query' => array(
array(
'key' => '_act_date-init-fix',
'value' => date('Y-m-d'),
'type' => 'DATE',
'compare' => '<', //for today or in the future
),
),
);
if ( $paged > 1 ) {
$args['paged'] = $paged;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment