How to add pagination links on single page
-
i have create this shortcode
function all_posts_mansory(){ $output = ''; $args = array( 'post_status' => 'publish' ); $args['paged'] = get_query_var( 'paged' ); $curtitle = get_category_parents( get_query_var('cat') , false , ' - ' ); //echo headers $output .= '<div class="section_title simple" id="section-title-5314721809a17" style="border-color: #dddddd;"><span class="title">?λα τα ?ρθρα</span></div><div id="clear-537bf6c690b21" class="clear"></div><style type="text/css">#clear-537bf6c690b21{padding-top:35px !important}</style>'; $output .= '<div class="post_list masonry isotope" style="display: block; position: relative; overflow: hidden; height:494px;">'; $recent_posts = new WP_Query( $args ); if ( $recent_posts->have_posts() ) { while ( $recent_posts->have_posts() ) { $recent_posts->the_post(); // do stuff $num_posts = count($recent_posts); //get ID,title,permalink etc $j=0; $recent_posts_usage = get_the_ID(); $this_ID = get_the_ID(); $post_class = join(" ", get_post_class('', $this_ID)); $this_title = get_the_title (); $category = get_the_category (); $this_category = $category[0]->cat_name; $this_thumb = get_the_post_thumbnail( $this_ID, 'medium'); $this_permalink = get_the_permalink(); $page_data = get_page( $this_ID ); $excerpt = T2T_Toolkit::truncate_string(apply_filters('the_content', strip_tags($page_data->post_content)), 200); //echo content $output .= '<div class="callout_box with_post one_fourth isotope-item'; if($j==3){ $output .= ' column_last'; $j=0; } else { $j++; } $output .= '" style="position: absolute; left: 0px; top: 0px; -webkit-transform: translate3d(476px, 0px, 0px);">'; $output .= '<article id="post-'.$this_ID.'" class="'.$post_class.'">'; $output .= ' <a href="'.$this_permalink.'"> '.$this_thumb.' </a>'; $output .= '<div class="callout_box_content">'; $output .= '<h3> <a href="'.$this_permalink.'">'.$this_title.' </a></h3>'; $output .= $excerpt; $output .='</div>'; $output .='</article>'; $output .='</div>'; } wp_reset_postdata(); } $output .='</div>'; return $output; } add_shortcode('show_all_posts_mansory', 'all_posts_mansory');
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
when i run it from my index.php wp page navi works nice https://fit-life.info/author/andreas_ioannidis/ but if i run this shortcode on a single page pagination works but the links above the articles doesnt show https://fit-life.info/ola-ta-arthra/page/2/
how i can fix it?
Thanks for your great pluginalso this is my page.php if it is helpfull
<?php get_header(); ?> <section id="content"> <div class="<?php echo get_post_meta(get_queried_object_id(), 'layout', true); ?> container"> <?php while (have_posts()) : the_post(); ?> <div class="page_content"> <?php the_content(); ?> </div> <?php endwhile; ?> <?php if(get_post_meta(get_queried_object_id(), 'layout', true) == "sidebar_right" || get_post_meta(get_queried_object_id(), 'layout', true) == "sidebar_left") { ?> <?php get_sidebar(); ?> <?php } ?> <div class="clear"></div> </div> </section> <?php get_footer(); ?>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘How to add pagination links on single page’ is closed to new replies.