Hello James,
sorry for this confusion.
I try to explain with my bad english .
I have website with lots of travels. Each post is one travel with several traveldates. The above code gives me a list of all dates sorted by the beginning of a travel like:
3.2.16 – 24.2.16 Brasil Price bookable ect.
4.2.16 – 16.2.16 Thailand price
ect.
All dates / informations are repeater fields:
named
t_block_beginn ; t_block_ende ; t_block_price ect.
Now I have to create a 2nd “block” of repeater fields with the same informations and named like
newdates_beginn ; newdates_ende ; newdates_price ect.
This 2nd “newdates – block” of repeater field shloud also be integrated in my query / sorted list …
Hope now its quite understandable ๐
Hello John, or somebody else,
could you please help me, how to add a custom filter in the frontpage to select the category ?
Thanks a lot
Taro
Thank you !!! It works ๐
Dear John,
one more question please.
What do I have to do, when I would like to publish only the next 5 events and not all ?
YES IT WORKS !!! THANK YOU VERYYY MUCH !!!!!! ๐
Dear John,
thank you for your reply.
Iยดm sorry, but when I put in your code, the table won’t show any dates. All empty. ๐
Dear John,
thank you for your reply.
Do you mean it like this? There must be a mistake somewhere…
maybe with the { ?
Sorry Iยดm an absolute newbie in php…
<?php
while ( have_rows('t_block') ) : the_row();
$now = strtotime(date('Y-m-d', time()));
// I am assuming that your date is stored as 'Y-m-d'
// see strtotime php doc form more information
$end_time - strtotime(get_sub_field('ende'));
if ($now > $end_time) {
// not in the future, go to the next row
continue;
}
// check if the repeater field has rows of data
if( have_rows('t_block') ):
echo '<h2>' . 'Reisetermine' . '</h2>';
echo "<table>";
echo '<tr> <th>'.''.'</th>';
echo '<th>' . '' . '</th>';
echo '<th>' . Anreise . '</th>';
echo '<th>'.''.'</th>';
echo '<th>' . Abreise . '</th>';
echo '<th>' . 'Preis p.P. <br> im DZ' . '</th>';
echo '<th>' . '' . '</th>';
echo '<th>' . '' . '</th>';
echo '<th>' . '' . '</th>';
echo '<th>' . '' . '</th>';
echo '<th>' . '' . '</th></tr>';
// loop through the rows of data
while ( have_rows('t_block') ) : the_row();
$date_beginn = DateTime::createFromFormat('Ymd', get_sub_field('beginn'));
$date_ende= DateTime::createFromFormat('Ymd', get_sub_field('ende'));
$preis= get_sub_field('preis');
$preis_ez= get_sub_field('ez_preis');
$buchbar= get_sub_field('buchbar');
$sprache= get_sub_field('sprache');
$anfrage= get_sub_field('anfrage');
$bemerkung= get_sub_field('bemerkung');
$garantiert= get_sub_field('gesichert');
// display a sub field value
echo '<tr><td>' . $garantiert . '</td>';
echo '<td>' . $buchbar . '</td>';
echo '<td>' . $date_beginn->format('d.m.Y') . '</td>';
echo '<td>' . '-' . '</td>';
echo '<td>' . $date_ende->format('d.m.Y') . '</td>';
echo '<td><strong>' . $preis . ' โฌ </strong> </td>';
echo '<td>' . $preis_ez . ' </td>';
echo '<td>' . $sprache . '</td>';
echo '<td><strong>' . $anfrage . '</strong></td>';
echo '<td>' . $bemerkung . '</td> </tr>';
endwhile;
echo "</table>";
else :
echo get_post_meta($post->ID, 'traveldates' ,true);
endif;
?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.