Hide Announcements in Certain Sections
3 posters
Page 1 of 1
Hide Announcements in Certain Sections
Is there a way to hide global announcements in certain sections of the forum?
There are sections we are turning into blogs and would like to remove the global announcements from being visible in them.
There are sections we are turning into blogs and would like to remove the global announcements from being visible in them.
Re: Hide Announcements in Certain Sections
Hi there,
Yes, I believe it's possible with JavaScript since you have to target the specific page when the user loads it up instead of having CSS target the entire forum.
Yes, I believe it's possible with JavaScript since you have to target the specific page when the user loads it up instead of having CSS target the entire forum.
Re: Hide Announcements in Certain Sections
Couldn't I just use CSS in the blog template to hide announcements that way?
If not, is there a script that already exists that I can use?
If not, is there a script that already exists that I can use?
Re: Hide Announcements in Certain Sections
Try adding to a new Javascript with Placement set to In the sub-forums:
In this part you can configure which forums will have the announcements hidden:
---
You have a beautiful forum, btw.
- Code:
(function($) {
'use strict';
if (!/^\/f\d+-/i.test(location.pathname)) {
return;
}
var config = {
forums: [1, 25],
query: [
'Important',
'Sticky',
]
};
var fid = ~~location.pathname
.split('/f')
.pop()
.split('-')
.shift()
;
if (config.forums.indexOf(fid) === -1) {
return;
}
var query = [];
$.each(config.query, function() {
query.push('.topic-type:contains("' + this + '")');
});
$(function() {
$(query.join(', ')).closest('tr').css('display', 'none');
});
}(jQuery));
In this part you can configure which forums will have the announcements hidden:
- Code:
var config = {
forums: [1, 25],
query: [
'Important',
'Sticky',
]
};
- forums is the list of IDs of the forums to have announcements hidden.
- query is what kind of topics will be hidden.
---
You have a beautiful forum, btw.
Similar topics
» Hide Admin Online Status & Hide Rank Title
» hide category + hide popup + pictures for posts
» How to add some sections in the forums
» Request code Sections ...
» how to add moderators to sections
» hide category + hide popup + pictures for posts
» How to add some sections in the forums
» Request code Sections ...
» how to add moderators to sections
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum