View Full Version : go to new post link
nelsantiago
05-24-2016, 03:55 PM
If I want to add a go to last post like
?goto=newpost
to the end of a search result, how would I go about doing that?
Here's the page in question
http://www.vdubaddiction.com/forums/splashpage
my users would like to have the latest topic links go to the last response. I know the code above will do that. But I'm not sure where to put it.
Thanks!
noypiscripter
05-24-2016, 04:01 PM
The >> icon in the Last Post column already does that.
nelsantiago
05-24-2016, 04:13 PM
I'm aware of that. They'd like the link itself to do that. Just like phpBB can.
noypiscripter
05-25-2016, 06:10 AM
You need to create a template hook at footer_before_body_end hook location. Then the template code to use is below:
<script>
(function($) {
var $container = $('#widget_182');
if ($container.length) {
$('.go-to-last-post', $container).each(function() {
var $this = $(this),
$postTitleLink = $this.closest('.js-topic-item').find('.js-topic-title');
$postTitleLink.attr('href', $this.attr('href'));
});
}
})(jQuery);
</script>
That will update the URL of the post title to be the same as that of the Go to Last Post icon. This will apply to the "Latest Updated Topics" module only which has id of widget_182. If you want to apply it everywhere, then just change:
var $container = $('#widget_182');
to:
var $container = $('.topic-list-container');
nelsantiago
05-25-2016, 12:49 PM
Do I need to clear the cache on the board cause that did nothing. Hopefully I followed the instructions correctly. See below
https://vborg.vbsupport.ru/external/2016/05/4.png
noypiscripter
05-25-2016, 05:51 PM
You need to create a new template named go_to_last_post under the theme/style that you're using and paste the code there not in that last field (Hook Arguments) which you should leave empty.
nelsantiago
05-25-2016, 07:16 PM
You sir, Are a genius! that was it. Sorry it wasn't clear that I had to make those two separately. Worked like a charm. Thank you. One last question. So now that it's going to last post, what would I need to do to make it go to last unread post? BTW This thread should be helpful to sooo many people. I've seen this question asked a lot of times in the archives with no real solution until now. Fantastic!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.