[newer | older ]
if i click newer , newer recent post will load.
either if i click older, then the next recent post will load.
I am new to wordpress. can who give me an idea to implement navigation inside this code. shown below?
<?php
$args = array( 'numberposts' => '3' );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ) {
echo '<li style="font-weight:700;"><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' . $recent["post_title"].'</a> </li> ';
echo '<li>' .wpautop(wp_trim_words($recent["post_content"], 15)). '</li>';
}
?>
what you want is the use of these two functions: get_next_post and get_previous_post
You can use these methods:
Note: if you want to know more about this then use can take a reference from these links get_previous_posts_link( $label) and another is get_next_posts_link( $label )