• Hi,
    I display my wordpress post in my html website. I’ve installed wordpress in wp directory.

    In index2test.php
    Head :
    <?php require('wp/wp-blog-header.php');?>

    Body :

    <?php function my_persolink($id=0) {
         if ($id == 0) {
              global $post;
              if ( empty($post->ID) )
                   return ;
              $id= $post->ID;
         }
         echo "https://www.ville-joeuf.fr/alaunetest2.php?idpost=" . $id;
    }?>
    <?php
        $args = array('post_status'=>"publish",'post_type'=>"post",'orderby'=>"post_date");
        $postslist = get_posts( $args );
    
        foreach ($postslist as $post) : setup_postdata($post);
    ?>
    <div class="article">
     <div class="Titre7" align="left"><?php the_title(); ?></div>
    <div class="thumbnail">
    <?php if ( has_post_thumbnail() ) {
      the_post_thumbnail('thumbnail');
    }?></div>
    <div class="alaune"> <?php the_excerpt(); ?></div>
    <div class="suite"><a>" title="<?php the_title(); ?>">Lire la suite</a> </div>
    </div>
    
    <?php endforeach; ?>

    In alaunetest2.php wich displays entire posts

    <?php
    $id=$_GET['idpost'];
    if (isset($id) && !empty($id)) {
       // pour un article
       $args = array ( 'p' => $id);
       query_posts( $args );
       while ( have_posts() ) : the_post();
    echo '<div class="Titre7">' . get_the_title(). '</div>';
        echo '<br />';
    
       the_content();
    endwhile;
    wp_reset_query();
    }
    else echo 'pas id';
    
    ?>

    How can i have my pagination working ?
    I’ve installed the WP-PageNavi plugin in my wordpress.
    In my index2test.php I put <?php wp_pagenavi(); ?> but it doesn’t work.
    How can I have pagination ?

    Thanx

  • The topic ‘WordPress posts in my html/php website’ is closed to new replies.