first
This commit is contained in:
38
wp-content/themes/pampadutheme/main-page.php
Normal file
38
wp-content/themes/pampadutheme/main-page.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
//Template Name: Blog
|
||||
//
|
||||
//
|
||||
get_header();
|
||||
|
||||
$current = !empty( $_GET['PAGEN'] ) ? $_GET['PAGEN'] : 1;
|
||||
$query = new WP_Query(
|
||||
[
|
||||
'post_type' => 'post',
|
||||
'posts_per_page' => 3,
|
||||
'paged' => $current,
|
||||
]
|
||||
);
|
||||
$myposts = get_posts( array(
|
||||
'posts_per_page' => 3,
|
||||
'paged' => $current,
|
||||
) );
|
||||
|
||||
foreach( $myposts as $post ){
|
||||
setup_postdata( $post );
|
||||
the_title();
|
||||
echo '<br>';
|
||||
}
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
echo wp_kses_post(
|
||||
paginate_links(
|
||||
[
|
||||
'total' => $query->max_num_pages,
|
||||
'current' => $current,
|
||||
'format' => '?PAGEN=%#%',
|
||||
'base' => site_url() . '%_%',
|
||||
]
|
||||
)
|
||||
);
|
||||
get_footer(); ?>
|
Reference in New Issue
Block a user