Periodi intensivi di ricerca

    [insert_php]

    $args = array(
    ‘posts_per_page’ => 400,
    ‘category_name’=> “Periodi intensivi di ricerca”
    );

    $myposts = get_posts( $args );

    $lines = array();

    foreach ( $myposts as $post ) {
    $custom_data=get_post_custom($post->ID);
    $link = get_permalink($post);
    $start_date = date_format(date_create_from_format(‘Ymd’, $custom_data[‘start_date’][0]), ‘d/m/Y’);
    $end_date = date_format(date_create_from_format(‘Ymd’, $custom_data[‘end_date’][0]), ‘d/m/Y’);

    $range_string = $start_date . (($end_date == “”) ? “” : (” – ” . $end_date)) ;

    $lines[ $custom_data[‘start_date’][0] ] = “

    ” .

    ” .
    “(” . $range_string . “)” .

    “;

    }

    //print_r($lines);
    krsort($lines);
    //print_r($lines);
    foreach($lines as $line) {
    echo “

  • “;
    echo $line;
    echo “
  • “;

    }

    [/insert_php]