Jump to content

How do I default minimize sidebar panel title on page load?


cdeese8

Recommended Posts

Specifically, I desire having the "Support Knowledgebase Tag Cloud" sidebar panel title minimized on page load on knowledgebasearticle.tpl and knowledgebasecat.tpl pages.

May you please recommend and share some wisdom? Might you know of a hook, that will automatically make it so the sidebar <div menuitemname="Support Knowledgebase Tag Cloud" class="panel panel-sidebar panel-sidebar"> is hidden / minimized by default?

Thanks in advance for whatever help you can offer.

Link to comment
Share on other sites

20 hours ago, cdeese8 said:

Specifically, I desire having the "Support Knowledgebase Tag Cloud" sidebar panel title minimized on page load on knowledgebasearticle.tpl and knowledgebasecat.tpl pages.

the following hook will minimise the tag cloud sidebar...

<?php

# Minimise Tag Cloud Sidebar Hook
# Written by brian! 

function minimise_tag_cloud_sidebar_hook($vars) {

	$kbpages = ['knowledgebase','knowledgebasecat','knowledgebasearticle'];
	$templatefile = $vars['templatefile'];
	if (in_array($templatefile,$kbpages)) {
		return <<<HTML
<script>
	jQuery(function(){
		jQuery('div[menuItemName="Support Knowledgebase Tag Cloud"]').find('i[class~="fa-chevron-up"]').click();
	});
</script>
HTML;
	}
}
add_hook("ClientAreaFooterOutput", 1, "minimise_tag_cloud_sidebar_hook");
?>

if it doesn't work for you, then you may need to declare the array using the old-fashioned method...

$kbpages = array('knowledgebase','knowledgebasecat','knowledgebasearticle');

... or don't use in_array and just use an "or" to check for the $templatename values in the ID statement. thanks.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated