Skip to main content
Topic: How to Make Recent Topics List Items Link to the First Post in a Topic (Read 1279 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How to Make Recent Topics List Items Link to the First Post in a Topic

Hello,

I'm using the default theme.

In the theme settings I have set it to show recent topics on board index. However when you click on a link in the list of posts displayed in the recent topics list that is shown, it takes you to the most recent reply in that post. How can I make it link instead to the original post (i.e the first post in the thread or the top of the first page of the thread)

Re: How to Make Recent Topics List Items Link to the First Post in a Topic

Reply #1

You will have to make an edit to that BoardIndex.template.php file

Code: (find) [Select]
		foreach ($context['latest_posts'] as $post)
{
echo '
then add the following in a new line after that { and before the echo as below.
Code: (add) [Select]
			$post['link'] = '<a href="' . $scripturl . '?topic=' . $post['topic'] . ' rel="nofollow">' . $post['subject'] . '</a>';

That should work

Re: How to Make Recent Topics List Items Link to the First Post in a Topic

Reply #2

Okay thanks a lot.

The links are now pointing to the first post quite alright so your solution worked, just that at the end of the urls it appends a space and then rel= . Not rel="nofollow", just rel=

As in:

https://myforum.com/index.php?topic=69 rel=

Re: How to Make Recent Topics List Items Link to the First Post in a Topic

Reply #3

Its missing an end quote ....  here use this
Code: [Select]
			$post['link'] = '<a href="' . $scripturl . '?topic=' . $post['topic'] . '" rel="nofollow">' . $post['subject'] . '</a>';

 

Re: How to Make Recent Topics List Items Link to the First Post in a Topic

Reply #4

It works fine now. Thanks a lot