Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ul>
- <?php
- // Build a custom query to get posts from future dates.
- $querystr = "
- SELECT wposts.*
- FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
- WHERE wposts.ID = wpostmeta.post_id
- AND wpostmeta.meta_key = 'Dato'
- AND STR_TO_DATE(wpostmeta.meta_value,'%d/%m/%Y') >= CURDATE()
- AND wposts.post_status = 'publish'
- AND wposts.post_type = 'post'
- ORDER BY STR_TO_DATE(wpostmeta.meta_value,'%d/%m/%Y') ASC
- LIMIT 3
- ";
- $events = $wpdb->get_results($querystr, OBJECT);
- if ($events):
- foreach ($events as $post):
- global $post;
- setup_postdata($post); ?>
- <li>
- <?php the_meta(Dato); ?><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
- </li>
- <?php endforeach;
- else : ?>
- <li>Can't find any posts...</li>
- <?php endif; ?>
- </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement