In single.php list other articles in this category
-
Hello, i’m close to solving this problem but there is just something missing…
Can someone please help. I am editing single.php and want a side bar that lists all other articles as links that are in the same category as this post. I would also like it to show the date that post was created.
This is what i have:
<?php foreach((get_the_category($post->ID)) as $category) { ?> <a class ="postLink" href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br/> <?php the_date(); ?> <br/> <?php }; ?>
Basically, this just behaves strangely. If there is only one post in the category it posts the name twice and only one date. So guessing my loop isn’t working correctly.
Anyone have and ideas?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘In single.php list other articles in this category’ is closed to new replies.