wp_pagenavi () avec wp_query () personnalisé?
-
-
voir - http://wordpress.stackexchange.com/questions/4696/pagination-not-working-with-custom-loop (engros,vous devez détourner leglobal $ wp_queryet l'utiliser au lieu de $ loopsee - http://wordpress.stackexchange.com/questions/4696/pagination-not-working-with-custom-loop (basically you need to hijack the $wp_query global and use it instead of $loop
- 0
- 2011-02-17
- onetrickpony
-
J'ai suivi lesinstructionset lanavigation s'affichemaintenant,mais lorsqueje vais à lapage 2,j'obtiens uneerreur.Voici lepastebin de ce quej'ai.Si vouspouvezjeter un œilet mefaire savoir si vous remarquez quelque chose demal,je vousen serai éternellement reconnaissant.Je vous remercie.http://pastebin.com/RMZaE6PiI followed the directions in there and the navigation shows now but when I go to page 2, I get an error. Here is the pastebin of what I have. If you can take a look and let me know if you notice anything wrong, I'd be forever grateful. Thank you. http://pastebin.com/RMZaE6Pi
- 0
- 2011-02-17
- J82
-
Quelleest l'erreur que vous obtenez?what is the error you are getting?
- 0
- 2011-02-17
- Bainternet
-
@One Trick Pony: Pouvez-vous déplacer votre commentaire vers une réponse,pour que Johnpuisse l'accepter?Peut-êtreincluremon commentaire dans la réponse référencée,car avec lanouvelle version de WP-Pagenavi,vouspouvezpasser un argument `query`.John aposé [une question de suivi] (http://wordpress.stackexchange.com/questions/9593/custom-post-types-and-wp-pagenavi)pour que lapaginationfonctionne.@One Trick Pony: Can you move your comment to an answer, so John can accept it? Maybe include my comment in the referenced answer, because with the new version of WP-Pagenavi you can pass a `query` argument. John asked [a followup question](http://wordpress.stackexchange.com/questions/9593/custom-post-types-and-wp-pagenavi) to get the paging working.
- 0
- 2011-02-17
- Jan Fabry
-
2 réponses
- votes
-
- 2011-02-17
wp_pagenavi( array( 'query' => $loop ) );
devraitfonctionner avec le code ci-dessus.Ne détournezpas la requêteprincipale si vouspouvez l'éviter.
wp_pagenavi( array( 'query' => $loop ) );
should work with the code above. Don't hijack the main query if you can avoid it.
-
Ma sourcepour cela: http://plugins.trac.wordpress.org/browser/wp-pagenavi/trunk/core.php#L3My source for this: http://plugins.trac.wordpress.org/browser/wp-pagenavi/trunk/core.php#L3
- 0
- 2011-02-17
- John P Bloch
-
Eneffet,la version de développement de WP Pagenavi (2.74-alpha) leprenden charge.Indeed, the development version of WP Pagenavi (2.74-alpha) supports this.
- 0
- 2011-02-17
- scribu
-
Oh,je ne savaispas que c'était la version de développement.Oops!Oh, I didn't realize this was the dev version. Oops!
- 0
- 2011-02-17
- John P Bloch
-
est-cepossible avecpaginate_links ()?is this possible with paginate_links() ?
- 0
- 2011-02-17
- onetrickpony
-
`paginate_links`est unpeuplusbasique.Au lieu de lui donner un objet de requête,vous luiindiquez lenombremaximal depages,lapage actuelleet quelques autresparamètres (comme leformat de l'url,etc.)`paginate_links` is somewhat more basic. Instead of giving it a query object, you tell it what the max number of pages are, what the current page is, and a few other parameters (like the format of the url, etc.)
- 0
- 2011-02-17
- John P Bloch
-
@John P Bloch: Je viens de lepublier: http://scribu.net/wordpress/wp-pagenavi/wpn-2-74.html :)@John P Bloch: Just released it: http://scribu.net/wordpress/wp-pagenavi/wpn-2-74.html :)
- 0
- 2011-02-17
- scribu
-
@scribu:testé avec untype depublicationpersonnaliséet lapaginationn'obtientpas lapage active si> 1,lorsque lespermaliens sont activés.C'estpeut-être lié à ceci: http://wordpress.stackexchange.com/questions/9537/pretty-paged-permalinks-in-custom-post-type-loop@scribu: tested it with a custom post type and the pagination doesn't get the active page if > 1, when permalinks are on. Maybe it's related to this: http://wordpress.stackexchange.com/questions/9537/pretty-paged-permalinks-in-custom-post-type-loop
- 0
- 2011-02-17
- onetrickpony
-
Avez-vousinclus «paginé»?Si oui,vous devezposer unenouvelle question,avec l'exemple de codeen piècejointe.Aussi,ne blâmezpaspagenavi;ilgénèrejuste des liens.:)Did you include 'paged'? If yes, you should ask a new question, with the code sample attached. Also, don't blame pagenavi; it just generates links. :)
- 0
- 2011-02-17
- scribu
-
Oui.inutile d'ouvrir unenouvelle question carje n'utiliseplus leplugin,soulignant simplement qu'ilne prendpasentièrementen charge cpt.Vous devriez ajouter un autre argument à wp_pagenavi (),comme 'current' dans lequel vouspouvezpasser lapage couranteparexemple.`get_permalink ()`yes. no point opening a new question as I don't use the plugin anymore, just pointing out that it doesn't fully support cpt. You should add another argument to wp_pagenavi(), like 'current' in which you can pass the current page eg. `get_permalink()`
- 0
- 2011-02-17
- onetrickpony
-
@john:j'aieu lemêmeproblème lors de l'utilisation de l'offset dans lepost de requêtepersonnalisé.Aidez-moi,s'il vousplaît !$ loop=new WP_Query (array ("paged=".get_query_var ('paged'). "& offset=1"));@john: i got same problem while using offset in custom query post . please help me ! $loop = new WP_Query(array("paged=".get_query_var('paged')."&offset=1"));
- 0
- 2011-06-03
- Gowri
-
- 2018-03-23
<?php // Pagination if(function_exists('wp_pagenavi')) : wp_pagenavi( array( 'query' => $blog_posts_query ) ); else : ?> <div class="navigation"> <div class="alignleft"><?php previous_posts_link() ?></div> <div class="alignright"><?php next_posts_link() ?></div> </div> <?php endif; // Restore original Post Data wp_reset_postdata(); ?>
<?php // Pagination if(function_exists('wp_pagenavi')) : wp_pagenavi( array( 'query' => $blog_posts_query ) ); else : ?> <div class="navigation"> <div class="alignleft"><?php previous_posts_link() ?></div> <div class="alignright"><?php next_posts_link() ?></div> </div> <?php endif; // Restore original Post Data wp_reset_postdata(); ?>
J'aiinstallépagenavijuste après lafin. Celane fonctionnepas,cependant. Quelqu'un sait-il commentje peuxfairefonctionner cela?