raffav
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Forum: Plugins
In reply to: Sort Posts By Custom Field Date?my solution is 2 loop, the first
$agenda = get_posts('category=4&numberposts=10'); <?php // an empty array $date_order = ''; if( $agenda ) : ?> <?php foreach( $agenda as $post ) : setup_postdata( $post ); ?> <?php $custom_date = get_post_custom_values('custom_date'); if (isset($custom_date[0])) { $evento = strtotime($custom_date[0]); } else { $evento = strtotime($post->post_date_gmt); } $date_order[$evento] = $post->ID; // now the array contain key as date and post ID as value ?> <?php endforeach; ?> <?php endif; ?> // and the second // order the date in the custom field ksort($date_order); foreach ($date_order as $key => $val) { query_posts('p='.$val); global $more; $more = 0; // the second Loop while (have_posts()) : the_post(); ?> // your stuff here <?php endwhile; ?> <?php } ?>in this way i can order post with or without date custom field
there are too many query?
it’s too many expensive?Forum: Plugins
In reply to: Let me create a plugin for youa plugin, or a way for support multiple child category with the same name
Forum: Themes and Templates
In reply to: Displaying new post in category listthis code work for me
get_categories( 'orderby=rand()&hide_empty=1&include_last_update_time=1&hierarchical=1&number=6&exclude=5,25);i simply tried to overwrite the orderby functions with a different possible options [rand()];
i hope this help to solve the bug.
Viewing 3 replies - 1 through 3 (of 3 total)