admin管理员组文章数量:1130349
I appreciate if someone can help me to explain why my post content shows below the pagination even though I echo the title only.
I call this code via shortcode.
INPUT:
// the query to set the posts per page to 3
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
$args = array('posts_per_page' => 3, 'paged' => $paged );
query_posts($args);
if ( have_posts() ) :
while (have_posts()) : the_post();
echo "<h2><a href='".get_the_permalink()."'>".get_the_title()."</a></h2>";
endwhile;
the_posts_pagination( array(
'mid_size' => 2,
'prev_text' => __( 'Previous page', 'findarch' ),
'next_text' => __( 'Next page', 'findarch' ),
'screen_reader_text' => __('navigation','findarch')
) );
else :
echo "NOT FOUND.";
endif;
wp_reset_postdata();
OUTPUT:
43e
Hello world!
navigation
Previous page 1 2 3 4
asdasd
dsad
as
das
d
asd
I appreciate if someone can help me to explain why my post content shows below the pagination even though I echo the title only.
I call this code via shortcode.
INPUT:
// the query to set the posts per page to 3
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
$args = array('posts_per_page' => 3, 'paged' => $paged );
query_posts($args);
if ( have_posts() ) :
while (have_posts()) : the_post();
echo "<h2><a href='".get_the_permalink()."'>".get_the_title()."</a></h2>";
endwhile;
the_posts_pagination( array(
'mid_size' => 2,
'prev_text' => __( 'Previous page', 'findarch' ),
'next_text' => __( 'Next page', 'findarch' ),
'screen_reader_text' => __('navigation','findarch')
) );
else :
echo "NOT FOUND.";
endif;
wp_reset_postdata();
OUTPUT:
43e
Hello world!
navigation
Previous page 1 2 3 4
asdasd
dsad
as
das
d
asd
本文标签: shortcodeContent included from pagination
版权声明:本文标题:shortcode - Content included from pagination 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749075965a2312310.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论