Problème de pagination (Créer un compte)

  • Statut : non résolu
2 sujets de 1 à 2 (sur un total de 2)
  • Auteur
    Messages
  • #548652
    wperle
    Membre
    Chevalier WordPress
    111 contributions

    Bonjour,

    Ma configuration WP actuelle :

    – Version de WordPress : 4.1.1
    – Version de PHP/MySQL : 5.4.10 / 5.5.29
    – Thème utilisé : AL AKHBAR (mon propre effort)
    – Extensions en place : Akismet (3.1.1), Contact Form 7 (4.1.1), Forum_wordpress_fr (3.9), Really Simple CAPTCHA (1.8.0.1), WordPress SEO (2.0), WP User Avatar (1.9.18)
    – Adresse du site : http://localhost:8888/0_voixdailleurs/version2015
    – Nom de l’hébergeur : Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/0.9.8y DAV/2 PHP/5.4.10

    Problème(s) rencontré(s) :

    la pagination fonction si je n’ajoute aucun critère à ma requête cad restituer tout les articles confondu mais une fois que j’ajoute un critère alors là la pagination ne fonctionne plus et je reste toujours sur la première page.

    div class= »row »>
    <?php
    // query_posts('posts_per_page=9');

    query_posts('showposts=9');
    if (have_posts()) : while (have_posts()) : the_post();
    $post_id = get_the_ID();

    ?>
    <!-- article 2 -->
    <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12 vignette">
    <div class="panel panel-default panel-index panel-index-default">
    <div class="panel-heading panel-index-heading">
    <span class="h5 pull-right"><?php the_category(', ') ?> </span>
    </div>


    <div class="panel-body panel-index-body">
    <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
    <?php
    echo get_avatar( get_the_author_meta( 'user_email' ), 60 );
    ?>
    </div>
    <div class="col-lg-9 col-md-9 col-sm-9 col-xs-39">
    <span>Écrit par</span>
    <p class="author-title">
    <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?> » rel= »author »>
    <?php echo get_the_author_meta( 'first_name')." ". get_the_author_meta('last_name');?>
    </a>
    </p>
    </div>


    <div class="clearfix"></div>

    <hr>
    <header class="post-thumbnail img-thumbnail img-responsive">
    <?php
    if ( has_post_thumbnail() ) {
    echo get_the_post_thumbnail( $post_id,array( 320, 210), array('class' => ‘img-responsive img-thumbnail’) );
    }
    else {
    echo ‘<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/img/thumbnail-default.jpg"
    class="img-responsive img-thumbnail width="320" height="210" />‘;
    }

    ?>
    </header><!-- .post-thumbnail -->

    <div class="clearfix"></div>
    <hr>
    <a href="<?php the_permalink() ?>« >
    <?php
    $title=get_the_title();
    if (strlen($title) > 80){
    $title = substr($title, 0, 50).’ …’;
    }
    echo $title; ?>

    </a>
    </div>

    <div class="panel-footer panel-index-footer">
    <div id="fb-root"></div>
    <?php alakhbar_rs(); ?>
    </div>
    </div>
    </div><!--/article 2 -->

    <?php endwhile; ?>
    </div> <!--/row-->

    <div class="row">
    <?php // Previous/next page navigation.
    the_posts_pagination( array(
    'mid_size' => 5,
    ‘prev_text’ => __( ‘Previous page’, ‘va’ ),
    ‘next_text’ => __( ‘Next page’, ‘va’ ),
    ‘before_page_number’ => ‘<span class="meta-nav screen-reader-text">‘ . __( ‘Page’, ‘va’ ) . ‘ </span>‘,
    ) );
    // ‘mid_size’ => 5, ne marche pas , I dont know suite à la documentation et si j’ai bien compris la pagination affichera 1 2 3 4 5
    ?>
    <?php else :
    ?> <h2>Not Found</h2>
    <?php endif; ?>

    #1000826
    wperle
    Membre
    Chevalier WordPress
    111 contributions

    Problème est solutionné.

    $arg = array(
    ‘post_type’ => ‘post’,
    ‘post__not_in’=> array($mesposts[0],$mesposts[1],$mesposts[2]),
    ‘category__not_in’ => array( 11 ),
    ‘posts_per_page’ =>9,
    ‘update_post_meta_cache’ => false
    );

    $my_query = new WP_Query($arg);

    if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();
    $post_id = get_the_ID();

2 sujets de 1 à 2 (sur un total de 2)
  • Le forum ‘Utilisation spécifique de WordPress’ est fermé à de nouveaux sujets et réponses.