The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Hide Announcements in Certain Sections

View previous topic View next topic Go down

Hide Announcements in Certain Sections

Post by Chelly on March 21st 2017, 12:16 am

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.
avatar
Chelly
Forumember

Posts : 43
Reputation : 1
Language : English

http://www.gasrforum.com/

Back to top Go down

Re: Hide Announcements in Certain Sections

Post by Draxion on March 24th 2017, 10:28 am

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.


NEVER provide your founder's account or email
Please provide forum's URL when dealing with design and appearance issues
Don't forget to mark the topic as when the issue is resolved. This helps the staff greatly.
PM Support is prohibited!
TOS | General Rules | FAQ | Tricks & Tips | Latest Updates | Introduce Yourself

avatar
Draxion
Support Moderator
Support Moderator

Male Posts : 1383
Reputation : 188
Language : English
Location : USA

http://www.draxionsgameden.com/

Back to top Go down

Re: Hide Announcements in Certain Sections

Post by Chelly on March 25th 2017, 12:07 am

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?
avatar
Chelly
Forumember

Posts : 43
Reputation : 1
Language : English

http://www.gasrforum.com/

Back to top Go down

Re: Hide Announcements in Certain Sections

Post by Kyo Panda on March 30th 2017, 4:39 pm

Try adding to a new Javascript with Placement set to In the sub-forums:

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.
avatar
Kyo Panda
Forumember

Male Posts : 33
Reputation : 19
Language : Portuguese, English
Location : Brazil

http://pt.rpgmaker.io

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum