Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved [How To?] How do I hide Sub Forums if there isn't one?
#1
Not Solved
Hello,

Currently, my theme has subforums as dropdowns. See below.
[Image: 3YTxKGO.png]
The problem is when there is no subforums to show, it's still displaying the Sub Forums: menu and opening a blank dropdown when clicked. See below.
[Image: 189dSjY.png]

You can also check it out on the site http://139.59.146.117/index.php

Is it possible to remove Sub Forums: menu when there is no subforums? If so, how do I do that?

Thanks
Reply
#2
Not Solved
admin control panel >> forums & Post

you can add, remove or edit (category, forum or sub forum)
Reply
#3
Not Solved
(09-12-2016, 02:09 AM)ziuma Wrote: admin control panel >> forums & Post

you can add, remove or edit (category, forum or sub forum)

Thanks for the answer but as I already mentioned in the thread, it shows Sub Forums: menu even if there isn't one. So that's not possible to fix this by removing the subforum since it'll still display the Sub Forums: dropdown menu.
Reply
#4
Not Solved
You should ask the theme creator for support, this does not happen with a default theme.
What goes around comes around
Reply
#5
Not Solved
Assuming the dropdown is by jQuery : You have to modify the dropdown function with a conditional check.
I don't have your code so here is an example for you to guide if you can get the idea from it:

$('#subforum').click(function(){
    if($(this).children().length > 0){
       // Initiate Dropdown ...
    }
});

NB: If you wanna use commom class for multiple dropdowns instead of id : try ".closest('class_name')" method.
[Image: logo.svg.svg]
Reply
#6
Not Solved
(09-12-2016, 11:49 AM)effone Wrote: Assuming the dropdown is by jQuery : You have to modify the dropdown function with a conditional check.
I don't have your code so here is an example for you to guide if you can get the idea from it:

$('#subforum').click(function(){
    if($(this).children().length > 0){
       // Initiate Dropdown ...
    }
});

NB: If you wanna use commom class for multiple dropdowns instead of id : try ".closest('class_name')" method.

I get it but I don't know how to apply this. So here is the code for the dropdown menu which is in the forumbit_depth2_forum template.

  <div class="forumhome_forum_bit" id="forum2">
        <div class="forumhome_forumbit_left" style="width: 100% !important; height: 100% !important;">
          <img src="images/bos.png" id="forum_statusicon_2">
          <a href="{$forum_url}">
            <span class="forumhome_forum_text">{$forum['name']}</span>
          </a>
        </div>
        <div class="forumhome_forumbit_right">

          <div id="forumhome_forumbit_subforums" class="hidden-xs hidden-sm">
            <a data-toggle="dropdown" href="#" role="button" aria-expanded="false">
              <span class="forumhome_subforum_text">{$lang->subforums}</span>
            </a>
            <ul class="forumhome_dropdown_menu dropdown-menu" role="menu">
				{$sub_forums}
            </ul>
          </div>


          <div id="forumhome_forumbit_lastpost">
           {$lastpost}
          </div>


        </div>
      </div>

This is the code that shows Sub Forums: menu. I guess it's not using jQuery, is it? The theme includes Bootstrap and using its dropdown feature. Can you help me with that?

(09-12-2016, 11:00 AM)Ashley1 Wrote: You should ask the theme creator for support, this does not happen with a default theme.

I can't because It was a custom made theme but the freelancer just ran away after he took the money and abandoned it. Undecided
Reply
#7
Not Solved
What do you have in forumbit_subforums template ?

This whole div should be ideally be placed there, then subforums will only appear when there are subforums.

<div id="forumhome_forumbit_subforums" class="hidden-xs hidden-sm">
<a data-toggle="dropdown" href="#" role="button" aria-expanded="false">
<span class="forumhome_subforum_text">{$lang->subforums}</span>
</a>
<ul class="forumhome_dropdown_menu dropdown-menu" role="menu">
{$sub_forums}
</ul>
</div>
What goes around comes around
Reply
#8
Not Solved
This is in the forumbit_subforums template:

<br />{$lang->subforums} {$sub_forums}
Reply
#9
Not Solved
(09-12-2016, 10:32 PM)aradabir007 Wrote:
(09-12-2016, 11:49 AM)effone Wrote: Assuming the dropdown is by jQuery : You have to modify the dropdown function with a conditional check.
I don't have your code so here is an example for you to guide if you can get the idea from it:

$('#subforum').click(function(){
    if($(this).children().length > 0){
       // Initiate Dropdown ...
    }
});

NB: If you wanna use commom class for multiple dropdowns instead of id : try ".closest('class_name')" method.

I get it but I don't know how to apply this. So here is the code for the dropdown menu which is in the forumbit_depth2_forum template.

  <div class="forumhome_forum_bit" id="forum2">
        <div class="forumhome_forumbit_left" style="width: 100% !important; height: 100% !important;">
          <img src="images/bos.png" id="forum_statusicon_2">
          <a href="{$forum_url}">
            <span class="forumhome_forum_text">{$forum['name']}</span>
          </a>
        </div>
        <div class="forumhome_forumbit_right">

          <div id="forumhome_forumbit_subforums" class="hidden-xs hidden-sm">
            <a data-toggle="dropdown" href="#" role="button" aria-expanded="false">
              <span class="forumhome_subforum_text">{$lang->subforums}</span>
            </a>
            <ul class="forumhome_dropdown_menu dropdown-menu" role="menu">
				{$sub_forums}
            </ul>
          </div>


          <div id="forumhome_forumbit_lastpost">
           {$lastpost}
          </div>


        </div>
      </div>

This is the code that shows Sub Forums: menu. I guess it's not using jQuery, is it? The theme includes Bootstrap and using its dropdown feature. Can you help me with that?

(09-12-2016, 11:00 AM)Ashley1 Wrote: You should ask the theme creator for support, this does not happen with a default theme.

I can't because It was a custom made theme but the freelancer just ran away after he took the money and abandoned it. Undecided

My friend, I believe I have the answer you're looking for.  


<span class="forumhome_subforum_text">{$lang->subforums}</span>
</a>


Change that to this:

<span class="forumhome_subforum_text">&nbsp;</span>
</a>


This would display a blank space rather then the word Sub Forums.
To take this a step further, you could try running a search for the $subforums template.  Do you know how to do that?  And why don't you try learning how to build the template yourself?  It's actually quite easy and fun once you get the hang of it!
Reply
#10
Not Solved
(09-12-2016, 11:01 PM)Ashley1 Wrote: What do you have in forumbit_subforums template ?

This whole div should be ideally be placed there, then subforums will only appear when there are subforums.

        <div id="forumhome_forumbit_subforums" class="hidden-xs hidden-sm">
          <a data-toggle="dropdown" href="#" role="button" aria-expanded="false">
            <span class="forumhome_subforum_text">{$lang->subforums}</span>
          </a>
          <ul class="forumhome_dropdown_menu dropdown-menu" role="menu">
               {$sub_forums}
          </ul>
        </div>

When I add this to forumbit_subforums, nothing happens

(09-12-2016, 11:17 PM)alfred702 Wrote:
(09-12-2016, 10:32 PM)aradabir007 Wrote:
(09-12-2016, 11:49 AM)effone Wrote: Assuming the dropdown is by jQuery : You have to modify the dropdown function with a conditional check.
I don't have your code so here is an example for you to guide if you can get the idea from it:

$('#subforum').click(function(){
    if($(this).children().length > 0){
       // Initiate Dropdown ...
    }
});

NB: If you wanna use commom class for multiple dropdowns instead of id : try ".closest('class_name')" method.

I get it but I don't know how to apply this. So here is the code for the dropdown menu which is in the forumbit_depth2_forum template.

  <div class="forumhome_forum_bit" id="forum2">
        <div class="forumhome_forumbit_left" style="width: 100% !important; height: 100% !important;">
          <img src="images/bos.png" id="forum_statusicon_2">
          <a href="{$forum_url}">
            <span class="forumhome_forum_text">{$forum['name']}</span>
          </a>
        </div>
        <div class="forumhome_forumbit_right">

          <div id="forumhome_forumbit_subforums" class="hidden-xs hidden-sm">
            <a data-toggle="dropdown" href="#" role="button" aria-expanded="false">
              <span class="forumhome_subforum_text">{$lang->subforums}</span>
            </a>
            <ul class="forumhome_dropdown_menu dropdown-menu" role="menu">
				{$sub_forums}
            </ul>
          </div>


          <div id="forumhome_forumbit_lastpost">
           {$lastpost}
          </div>


        </div>
      </div>

This is the code that shows Sub Forums: menu. I guess it's not using jQuery, is it? The theme includes Bootstrap and using its dropdown feature. Can you help me with that?

(09-12-2016, 11:00 AM)Ashley1 Wrote: You should ask the theme creator for support, this does not happen with a default theme.

I can't because It was a custom made theme but the freelancer just ran away after he took the money and abandoned it. Undecided

My friend, I believe I have the answer you're looking for.  


<span class="forumhome_subforum_text">{$lang->subforums}</span>
</a>


Change that to this:

<span class="forumhome_subforum_text">&nbsp;</span>
</a>


This would display a blank space rather then the word Sub Forums.
To take this a step further, you could try running a search for the $subforums template.  Do you know how to do that?  And why don't you try learning how to build the template yourself?  It's actually quite easy and fun once you get the hang of it!

This removed the Sub Forums: text even if there are subforums. So this didn't work. I don't know how to do that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)