i have problem. I use this code before comment form.
<?php
global $post;
$args = array( 'posts_per_page' => 5, 'offset'=> 1, 'category' => 1 );
$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
<?php the_permalink(); ?><?php the_title(); ?>
<?php endforeach; ?>
I have in single.php
:
1 -- post content
2 -- recent post
3 -- form comment
But when i comment something my comment is not on post but was added to last recent post. How can i do this?
I tried to use this:
<?php
$args = array(
'posts_per_page' => 1,
'category__not_in' => array( 23, 24 )
);
$recent_posts = get_posts( $args );
foreach ( $recent_posts as $recent ) {
echo '<a href="' . get_permalink( $recent ) . '">Latest Post</a>';
}
?>