parcourez simplement les messages
-
-
Si votre code s'exécute lui-même dans laboucle,vousn'obtiendrezpas les résultats attendus.Où s'exécute cetextrait de code?If your code is itself running in the loop, you won't get expected results. Where is this snippet running?
- 0
- 2011-12-22
- brandwaffle
-
juste après le corps,je pensais que c'était laboucle,les have_posts ...?unpeu confus.voicitout le code: http://pastebin.com/k2rDu53bright after the body, I thought that was the loop, the have_posts...? a little confused. here is all the code:http://pastebin.com/k2rDu53b
- 0
- 2011-12-22
- user766607
-
Je voulais dire si vous étiez déjà dans laboucleet que vous aviez ce code à l'intérieur ...pas ce qui sepasse detoutefaçon.Quelleest la sortie que vous voyez sur lapage?I meant if you were already in the loop, and then you had that code inside there...not what's happening anyway. What is the output you're seeing on the page?
- 0
- 2011-12-22
- brandwaffle
-
Je viens detester cela surmoninstallation WP localeet celame montre lestitres des articles commeje m'y attendais.Est-ce dans votre dossier dethèmeet est-ilexécutéen tant quethème actif,ouest-il chargé d'une autremanière?Si c'est unthème,avez-vous unefeuille style.css avec aumoins lesinformations debase définiesici?http://codex.wordpress.org/Theme_Development#Template_Files_ListJust tested this on my local WP install and it's showing me post titles as I'd expect. Is this in your theme folder and is it running as the active theme, or is it being loaded some other way? If it's a theme, do you have a style.css sheet with at least the basic info defined there? http://codex.wordpress.org/Theme_Development#Template_Files_List
- 0
- 2011-12-22
- brandwaffle
-
Pourquoitout le code d'en-tête dans lemodèle?Appelez simplement `get_header ()` à laplace,s'il doit différer dufichier d'en-têteprincipal,créez-en un autre,parexemple.`header-two.php` avec le codeet appelez-le dans lemodèle à laplace,parexemple.`get_header ('deux')`Why all the header code in the template? Just call `get_header()` instead, if it needs to differ from the main header file, create another eg. `header-two.php` with the code and call that in the template instead, eg. `get_header( 'two' )`
- 0
- 2011-12-23
- t31os
-
o!Jen'aipas réalisé que vouspouviezfaire deuxen-têtes.c'estgénial.mercipour letuyau.o! didn't realize you can do two headers. thats awesome. thanks for tip.
- 0
- 2011-12-27
- user766607
-
1 réponses
- votes
-
- 2011-12-22
Comme vous êtes sur unepage,celan'affichera que la requêtepour cettepage.Entant quetel,vous devrez créer unenouvelle requêtepourimporter lespublications souhaitées.Remplacez votrebouclepar ceci:
<?php $args = array( 'post_type' => 'post' ); $post_query = new WP_Query($args); if($post_query->have_posts() ) { while($post_query->have_posts() ) { $post_query->the_post(); ?> <h2><?php the_title(); ?></h2> <?php } } ?>
Voici quelquesinformations supplémentaires sur la requête: http://codex.wordpress.org/Class_Reference/WP_Query
Because you're on a page, that's only going to display the query for that page. As such, you'd have to create a new query to bring in the posts you want. Replace your loop with this:
<?php $args = array( 'post_type' => 'post' ); $post_query = new WP_Query($args); if($post_query->have_posts() ) { while($post_query->have_posts() ) { $post_query->the_post(); ?> <h2><?php the_title(); ?></h2> <?php } } ?>
Here some more information on the query: http://codex.wordpress.org/Class_Reference/WP_Query
-
À lafin,vous devez réinitialiser la requête avec `wp_reset_postdata ();` `https://codex.wordpress.org/Function_Reference/wp_reset_queryAt the end, you should reset the query with `wp_reset_postdata();` https://codex.wordpress.org/Function_Reference/wp_reset_query
- 3
- 2017-03-18
- jjj
Je sais que c'est une question vraimentnovice,maisje n'arrivepas à comprendre laboucle àtirer desmessages.tout ce qu'ilfaitest detirer de lapageelle-même.
J'ai créé unmodèleet y ai ajouté laboucle.
edit: voicitout le code: http://pastebin.com/k2rDu53b