sort custom type posts by date, php
-
Hi there
I need to display custom type posts creatd via plugin sorted by date, asc
I’ve tried to usesort ($fecha)but It didn’t work, can anyone help me with thishere the php code for the page template
<?php // The Loop while ( $query->have_posts() ) : $query->the_post(); $fecha = get_post_meta($post->ID, "fecha", true); $fecha_tmp = explode("/",$fecha); $fecha_format = (int)($fecha_tmp[2] . $fecha_tmp[0] . $fecha_tmp[1]); if ($fecha_format >= $fecha_actual) { ?> <p class="main-blog8leftcontent"><span><strong><?php echo date("d/m/Y", strtotime(get_post_meta($post->ID, "fecha", true))) ?> <?php echo get_post_meta($post->ID, "lugar", true) ?></strong></span> <span><?php the_title() ?></span> <span><a href="<?php echo anyade_http(get_post_meta($post->ID, "link", true)) ?>"><?php _e("més informació") ?></a></span></p> <?php }; endwhile; // Reset Post Data wp_reset_postdata(); ?>thanks in advance
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘sort custom type posts by date, php’ is closed to new replies.