ElkArte Community

Elk Development => Theme development => Topic started by: hitokiri on December 30, 2020, 03:25:58 pm

Title: How to Make Recent Topics List Items Link to the First Post in a Topic
Post by: hitokiri on December 30, 2020, 03:25:58 pm
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)
Title: Re: How to Make Recent Topics List Items Link to the First Post in a Topic
Post by: Spuds on December 31, 2020, 03:51:50 pm
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
Title: Re: How to Make Recent Topics List Items Link to the First Post in a Topic
Post by: hitokiri on December 31, 2020, 05:31:58 pm
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=
Title: Re: How to Make Recent Topics List Items Link to the First Post in a Topic
Post by: Spuds on December 31, 2020, 05:35:05 pm
Its missing an end quote ....  here use this
Code: [Select]
			$post['link'] = '<a href="' . $scripturl . '?topic=' . $post['topic'] . '" rel="nofollow">' . $post['subject'] . '</a>';
Title: Re: How to Make Recent Topics List Items Link to the First Post in a Topic
Post by: hitokiri on January 01, 2021, 04:58:53 am
It works fine now. Thanks a lot