Answer the question
In order to leave comments, you need to log in
How to set up links to posts, wordpress?
I post entries with a link to it.
When you click on the link, it redirects to the main one, if you specify "more" in the entry itself, the same story. What am I doing wrong? I want to click on the post link to go to it. <a href="<?php the_permalink();?>">
Answer the question
In order to leave comments, you need to log in
Read about get_posts( $args ); setup_postdata($post); wp_reset_postdata();
global $post;
// !!! Аргументы настройте "под себя"
$args = array( 'numberposts' => 9 , 'category' => 1, 'orderby' => 'date');
$myposts = get_posts( $args );
foreach( $myposts as $post ){ setup_postdata($post);
?>
<div class="post">
<div class="post-img"><?php the_post_thumbnail('thumbnail'); ?></div>
<div class="post-txt">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="post-date"><?php echo get_the_date('j F Y'); ?></div>
</div>
</div>
<?php
}
wp_reset_postdata();
// Код написан в качестве примера. Нужны правки и доработки
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question