How to Add Excerpts to Your Pages in WordPress
you will need to add the following code to your current themes functions.php file
For custom pagination Add Following code in your current themes functions.php file.
max_num_pages;
if(!$numpages) {
$numpages = 1;
}
}
$pagination_args = array(
‘base’ => get_pagenum_link(1) . ‘%_%’,
‘format’ => ‘page/%#%’,
‘total’ => $numpages,
‘current’ => $paged,
‘show_all’ => False,
‘end_size’ => 1,
‘mid_size’ => $pagerange,
‘prev_next’ => True,
‘prev_text’ => __(‘«’),
‘next_text’ => __(‘»’),
‘type’ => ‘array’,
‘add_args’ => false,
‘add_fragment’ => ”
);
$paginate_links = paginate_links($pagination_args);
if (is_array($paginate_links)) {
echo “
“;
}
echo ‘
‘;
echo “
“;
}
}
//call your pagination function in your post loop
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
$args = array(
‘paged’ => $paged, // pass paged parameter
‘post_type’=> ‘post’,
‘orderby’ => ‘ID’,
‘post_status’ => ‘publish’,
‘order’ => ‘DESC’,
‘posts_per_page’ => 4
);
$result = new WP_Query( $args );
if ( $result-> have_posts() ) :
while ( $result->have_posts() ) : $result->the_post();
the_title();
endwhile;
endif;
wc_custom_pagination($result->max_num_pages,””, $paged); // call pagination function after post loop
wp_reset_postdata();
?>
PREVIOUS PAGE
Delete Old Post in WordPress
Leave a Reply