2017-12-08 1 views
2

ウィジェット)私は(pagination_navと試みた改ページはWordpressの最新の投稿で改ページを追加Wordpressの最新の投稿で

\t public function widget($args, $instance) { 
 
\t \t extract($args); 
 
\t \t $title \t \t \t = apply_filters('widget_title', $instance['title']); 
 
\t \t $count \t \t \t = $instance['count']; 
 
\t \t $category \t \t = $instance['category']; 
 
\t \t echo $before_widget; 
 
\t \t $output = ''; 
 
\t \t if ($title) 
 
\t \t \t echo $before_title . $title . $after_title; 
 
\t \t global $post; 
 
\t \t if (isset($category) && $category != '') { 
 
\t \t \t $args = array(
 
\t \t \t \t 'category_name' => $category, 
 
\t \t \t \t 'posts_per_page' => $count, 
 
\t \t \t); 
 
\t \t } else { 
 
\t \t \t $args = array(
 
\t \t \t \t 'posts_per_page' => $count, 
 
\t \t \t); 
 
\t \t } 
 
\t \t $posts = get_posts($args); 
 
\t \t if(count($posts)>0){ 
 
\t \t \t $output .='<div class="sp-latest-posts-widget latest-posts">'; 
 
\t \t \t foreach ($posts as $post): setup_postdata($post); 
 
\t \t \t \t $output .='<div class="media">'; 
 

 
\t \t \t \t \t if(has_post_thumbnail()): 
 
\t \t \t \t \t \t $output .='<div class="pull-left">'; 
 
\t \t \t \t \t \t $output .='<a href="'.get_permalink().'">'.get_the_post_thumbnail($post->ID, 'xs-thumb', array('class' => 'img-responsive')).'</a>'; 
 
\t \t \t \t \t \t $output .='</div>'; 
 
\t \t \t \t \t endif; 
 

 
\t \t \t \t \t $output .='<div class="media-body">'; 
 
\t \t \t \t \t $output .= '<h3 class="entry-title"><a href="'.get_permalink().'">'. get_the_title() .'</a></h3>'; 
 
\t \t \t \t \t $output .= '<div class="entry-meta small"><span class="st-lp-time">'. get_the_time() . '</span> <span clss="st-lp-date">' . get_the_date('d M Y') . '</span></div>'; 
 
\t \t \t \t \t $output .='</div>'; 
 
\t \t \t \t $output .='</div>'; 
 
\t \t \t endforeach; 
 
\t \t \t wp_reset_query(); 
 
\t \t \t $output .='</div>'; 
 
\t \t } 
 
\t \t echo $output; 
 
\t \t echo $after_widget; 
 
\t }
を追加したいウィジェット。 functions.phpでコードを追加した後、私はWP-PageNaviを使用しましたが、成功しませんでした。 この場合、番号付きページネーションを追加するにはどうすればよいですか? ありがとうございます!番号のページネーションのためのコードの下

答えて

0

使用、

<?php the_posts_pagination(array(
     'mid_size' => 1, 
     'prev_text' => __('Prev', 'textdomain'), 
     'next_text' => __('Next', 'textdomain'), 
     'screen_reader_text' => ' ', 
    )); 

    } ?> 
+0

は、あなたの答えのためにJHAをbaijuいただきありがとうございますが、私の問題は、私はどちらかの数字や他の人と、改ページを表示することができないということです。 –

関連する問題