Hi :-)
Can you please share how you solved this as it is something many people in the community are hoping to achieve. I have been playing with the script for 2 days now lol.
Many thanks in anticipation of your reply.
Stuart
I am showing my functions.php file for your use. I have sent the same file to osclasswizards for them to look at as well. Once you make the changes to the functions.php file make sure to raise the subcategory limit in the admin panel to 100. That way all the subcategories show when you click the main category. The changes that need to be made are in line 61 - set it to "0" the go to lines 374 to 382 and make tyhose changes as well and you wiull have your dropdown categories. I added to span class for the badges to align properly so dont forget to make those changes as well in the same lines.
Whoop Whoop!
Find the following code around line 61... and set the sub cat limit to "0"
//templates
if( !osc_get_preference('search_select', 'osclasswizards_theme') ) {
osc_set_preference('search_select', 'region', 'osclasswizards_theme');
}
if( !osc_get_preference('sub_cat_limit', 'osclasswizards_theme') ) {
osc_set_preference('sub_cat_limit', 0, 'osclasswizards_theme'); }
if( !osc_get_preference('popular_regions_limit', 'osclasswizards_theme') ) {
osc_set_preference('popular_regions_limit', 10, 'osclasswizards_theme');
Then go to the code around line 372 to 384 and make these changes...
<section class="listings">
<h2><i class="fa fa-<?php echo osclasswizards_category_icon( osc_category_id() ); ?>"></i>
<?php
$_slug = osc_category_slug();
$_url = osc_search_category_url();
$_name = osc_category_name();
$_total_items = osc_category_total_items();
if ( osc_count_subcategories() > 0 ) { ?>
<?php } ?>
<?php if($_total_items > 0) { ?>
<a class="category <?php echo $_slug; ?>" href="<?php echo $_url; ?>"><?php echo $_name ; ?></a>
<?php } else { ?>
<a class="category <?php echo $_slug; ?>" href="#"><?php echo $_name ; ?></a>
<?php } ?>
</h2>
<div class="dropdown">
<button class="btn btn-default btn-block dropdown-toggle" type="button" data-toggle="dropdown">
<span class="caret"></span></button>
<ul class="dropdown-menu btn-block"> <?php if ( osc_count_subcategories() > 0 ) { $m=1; ?>
<ul class="list-group"> <?php while ( osc_has_subcategories() ) { if( $m<=(osc_get_preference('sub_cat_limit', 'osclasswizards_theme'))){?>
<li class="list-group-item"> <?php if( osc_category_total_items() > 0 ) { ?>
<a class="category sub-category <?php echo osc_category_slug() ; ?>" href="<?php echo osc_search_category_url() ; ?>"><?php echo osc_category_name() ; ?></a>
<span class="badge"><?php echo osc_category_total_items() ; ?></span> <?php } else { ?>
<a class="category sub-category <?php echo osc_category_slug() ; ?>" href="#"><?php echo osc_category_name() ; ?>
</a> <span class="badge"><?php echo osc_category_total_items() ; ?></span> <?php } ?>
</li>
Then make sure to change the subcategory limit in the admin panel to 100
Save and refresh your screen - you should have what you want...
Whoop Whoop!