Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- get_header();
- ?>
- <?php
- // global $wp_query;
- // 1) invoquer notre Objet WP_Query qui nou sera utile tout au long de cette page
- $wp_query_object = new WP_Query();
- /* 4 Premiers Posts
- *******************/
- // 2) Créer un tableau de critères de recherche pour retrouver les postes qu'on veux
- $criteres_de_recherche = array(
- 'category__not_in' => array( 7 ),
- 'posts_per_page' => 4
- );
- $quatre_premiers_posts = $wp_query_object->query( $criteres_de_recherche );
- //echo $quatre_premiers_posts[0]->post_title;
- //print_r( $quatre_premiers_posts );
- /* générer les tags des posts
- *******************************/
- $t0 = wp_get_post_tags($quatre_premiers_posts[0]->ID);
- $t1 = wp_get_post_tags($quatre_premiers_posts[1]->ID);
- $t2 = wp_get_post_tags($quatre_premiers_posts[2]->ID);
- $t3 = wp_get_post_tags($quatre_premiers_posts[3]->ID);
- // print_r($t0);
- // print_r($t1);
- // print_r($t2);
- // print_r($t3);
- /* générer les permaliens
- *************************************************/
- $perma0 = get_permalink($quatre_premiers_posts[0]->ID);
- $perma1 = get_permalink($quatre_premiers_posts[1]->ID);
- $perma2 = get_permalink($quatre_premiers_posts[2]->ID);
- $perma3 = get_permalink($quatre_premiers_posts[3]->ID);
- // print_r($perma0);
- // print_r($perma1);
- // print_r($perma2);
- // print_r($perma3);
- /* Générer les posts de news (DANS LA PRESSE)
- *************************************************/
- $criteres_de_recherche = array (
- 'category__in' => array (7),
- 'posts_per_page' => 2
- );
- $agenda_posts = $wp_query_object->query($criteres_de_recherche);
- // print_r ($agenda_posts);
- /* Générer les liens (Custom Field) des articles de l'agenda
- ************************************************************/
- $champslien = get_post_custom($agenda_posts[0]->ID);
- $lien = $champslien['lien'];
- $champslien2 = get_post_custom($agenda_posts[1]->ID);
- $lien2 = $champslien2['lien'];
- // print_r($lien);
- /* générer les images thumbnail (articles)
- ***************************************************/
- $mon_image0 = wp_get_attachment_image_src( get_post_thumbnail_id($quatre_premiers_posts[0]->ID), 'original');
- $mon_image1 = wp_get_attachment_image_src( get_post_thumbnail_id($quatre_premiers_posts[1]->ID), 'original');
- $mon_image2 = wp_get_attachment_image_src( get_post_thumbnail_id($quatre_premiers_posts[2]->ID), 'original');
- $mon_image3 = wp_get_attachment_image_src( get_post_thumbnail_id($quatre_premiers_posts[3]->ID), 'original');
- //print_r( $mon_image0 );
- ?>
- <!-- Ouverture et début du main. -->
- <div id="main">
- <!-- Première colonne, première ligne - article 1 et son thumbnail, le tout sur deux colonnes. -->
- <div class="left mr mt col gudea">
- <div class="post-date left"><?php echo mysql2date("j F Y", $quatre_premiers_posts[0]->post_date);?> | <?php echo $t0[0]->name; ?> | <?php echo $t0[1]->name; ?>
- </div>
- <div class="clear">
- </div>
- <h1><a href="<?php echo $perma0 ?>"><?php echo $quatre_premiers_posts[0]->post_title;?>
- </a></h1>
- <div class="extrait"> <?php echo cut($quatre_premiers_posts[0]->post_excerpt, 600) ?>
- <div class="suite"><?php echo lire_la_suite($perma0) ?></div>
- </div>
- </div>
- <div class="left mr2 mt colimage ">
- <div class="post-thumbnail"><a href="<?php echo $perma0 ?>"><img src="<?php bloginfo('template_url'); ?>/timthumb.php?src=<?php echo $mon_image0[0]; ?>&w=272&h=400" alt=" L'image à la une de cet article!"></a>
- </div>
- </div>
- <!-- Fin du premier article et de son image sur deux colonnes. -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement