0

ワードプレスではよくわかりません。多分これはばかげた質問です。

カスタムページ、ブログ名を作成します。すべてのブログ投稿が入力されました。質問したいのは、このようなページネーションを作成する方法です。<< Pre [1] [2] [3] ... Next >>投稿番号は、[設定]>[閲覧]>[ブログページの表示]から決定されます...。役職。

これは私のコードです。

<div class="page-content">
  <?php
    $paged = (get_query_var('page')) ? get_query_var('page') : 1;
    $args_recent_posts = array( 'post_type' => 'post', 'paged' => '$paged');
    $loop_recent_posts = new WP_Query( $args_recent_posts );
      if ( $loop_recent_posts->have_posts() ) :
        function the_excerpt_max_charlength($charlength)
          {
            $excerpt = get_the_excerpt();
            $charlength++;

            if ( strlen( $excerpt ) > $charlength )
              {
                $subex = mb_substr( $excerpt, 0, $charlength - 5 );
                $exwords = explode( ' ', $subex );
                $excut = - ( strlen( $exwords[ count( $exwords ) - 1 ] ) );

            if ( $excut < 0 )
              {
                 echo mb_substr( $subex, 0, $excut );
              }
            else
              {
                echo $subex;
              }
                echo '...';
              }
            else
              {
                echo $excerpt;
              }
          }  
      while ( $loop_recent_posts->have_posts() ) : $loop_recent_posts->the_post();
  ?>
  <div class="entry-item">
    <div class="entry-image-col1">
      <div class="ch-item chi-mg">
        <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'page-image-1' ); } ?>
        <div class="ch-info"> <a href="<?php the_permalink(); ?>" class="detail">See Full Post</a> </div>
      </div>
    </div>
    <div class="entry-info-col1">
      <div class="entry-meta">
        <div class="entry-date">
          <?php the_time('j M'); ?>
        </div>
        <div class="entry-author">Author : <span>
          <?php the_author_posts_link(); ?>
          </span></div>
        <span class="entry-comment">Comment : <span>
        <?php comments_number( 'no', 'one', '%' ); ?>
        </span></span> </div>
      <div class="entry-content">
        <div class="entry-title"><a href="<?php the_permalink(); ?>">
          <?php the_title(); ?>
          </a></div>
        <p><?php echo substr(get_the_excerpt(), 0,250); ?></p>
        <a href="<?php the_permalink(); ?>" class="link"><?php echo __( 'Read More &raquo;'); ?></a> </div>
    </div>
  </div>
   <?php endwhile; endif; wp_reset_query(); ?>
  <div class="navigation">
    <div class="alignleft">
      <?php next_posts_link('« Older Entries') ?>
    </div>
    <div class="alignright">
      <?php previous_posts_link('Newer Entries »') ?>
    </div>
  </div>
</div>

誰かが私を助けてくれることを願っています。ありがとうございました。

4

1 に答える 1

-3

WPPaginateを使用してください-非常に使いやすいです。

于 2013-03-25T17:02:57.857 に答える