Notifications
Clear all

wpForo 1.x.x [Closed] Make forum column clickable

10 Posts
2 Users
4 Likes
2,409 Views
Posts: 13
Topic starter
(@cherry)
Eminent Member
Joined: 5 years ago

Hi,

I'd like my forum to be more mobile friendly and clicking on the words is harder because they're small. How can I make it so the entire column is clickable, not just the words?

Thanks!

9 Replies
Posts: 13
Topic starter
(@cherry)
Eminent Member
Joined: 5 years ago

So I found this: https://ctrlq.org/code/19639-turn-div-clickable-link

Which allows me to achieve what I want to do on desktop, but it doesn't work on mobile. It also requires me to add JS, which could be overwritten on plugin update.

Has anyone been able to do this?

VereK
Posts: 495
(@verek)
Honorable Member
Joined: 6 years ago

Negate the hassle of child themes and updates overwriting your edits by installing: https://wordpress.org/plugins/code-snippets/

clicking on the words

Not sure what you mean by "words" so here is a quick n dirty snippet to cover a few scenarios (not tested yet):

<script>
// For Forum info divs - if you have links in your forum description they will only be clickable from within the forum, not on the main index.
jQuery(document).ready(function($) {
jQuery("[id^=wpf-forum-] > div > div.wpforo-forum-info").click(function(){
window.location = $(this).find("a:first").attr("href");
return false;
});
// For Extended layout topic titles
jQuery(document).ready(function($) {
jQuery("#wpforo #wpforo-wrap > div.wpforo-main.wpft-topic > div.wpforo-content > div.wpfl-1 >").click(function(){
window.location = $(this).find("a:first").attr("href");
return false;
});
// For Threaded layout topic titles
jQuery("#wpf-cat-18 > div.wpf-threads > div.wpf-thread-list > div").click(function(){
window.location = $(this).find("a:first").attr("href");
return false;
});
});
});

</script>
Posts: 13
Topic starter
(@cherry)
Eminent Member
Joined: 5 years ago

Thanks so much for your help.

So I added this code in the code snippets plugin and the first error I got was < on line 1. So I removed the script lines and now the error I get is:

The code snippet you are trying to save produced a fatal error on line 3:

syntax error, unexpected '$', expecting variable (T_VARIABLE)

Posts: 13
Topic starter
(@cherry)
Eminent Member
Joined: 5 years ago

Okay so the error happens even when I put the working code in the snippets plugin, so I'm testing this outside of the snippets plugin, directly in the JS of the plugin.

For the first section

jQuery(document).ready(function($) {
jQuery("[id^=wpf-forum-] > div > div.wpforo-forum-info").click(function(){
window.location = $(this).find("a:first").attr("href");
return false;

If I remove [id^=wpf-forum-] > div > div, then it works just as the other code did (it's pretty much the same). But leaving that in doesn't work at all and the column is not clickable.

As for the other two sections, I wouldn't begin to know where to even start on editing them to work.

Page 1 / 2