Issue with Subcategories Widget Displaying Excessive Nested Categories

Posted in: Newspaper
Post count: 35449

Hi,
The update includes an option to display the current category, but as far as I remember, it’s not exactly the option you’re looking for.
I’ll check this and let you know whether the solution mentioned above will still work. If it needs to be adjusted, I’ll do so and provide the updated solution here.
Thank you!

Post count: 201

Hi all,

Do we know if the fix has been rolled into any recent release?

Post count: 35449

Hi c386, please use the added option for “Include current category” – https://i.imgur.com/CxnkZSN.png. This should bring the functionality from Newsapper 12.6.8 when the current category was displaied in the Category Siblings

Post count: 201

Hi Calin,

That doesn’t quite fix the underlying problem.

For example, if my category hierarchy were as follows:

Category 1
– sub-category 1
– sub-category 2
– sub-category 3
Category 2
Category 3
– sub-category 4
– sub-category 5

Category 1 page would show ‘sub-category 1’, ‘sub-category 2’ and ‘sub-category 3’ when using category siblings.
Category 3 page would show ‘sub-category 4’ and ‘sub-category 5’ as siblings.

Both of the above would be correct, however Category 2 page, with no available subcategories, would incorrectly show ‘Category 1’, ‘sub-category 1’, ‘sub-category 2’, ‘sub-category 3’, ‘Category 3’, ‘sub-category 4’ and ‘sub-category 5’.

In previous versions, siblings were ignored if no sub-categories are present. That’s how I believe it should be.

Post count: 35449

I understand. Please use the code from here https://cdn.tagdiv.com/wp-content/uploads/2026/01/tdb_state_category.zip you need to unzip the file and replace the file from the path wp-content/plugins/td-cloud-library/state/category/tdb_state_category.php
Before this, make sure you have a full backup.

Post count: 201

Hi Calin,

Thank you for the revised code. Can I assume this will be rolled into the next release?

Post count: 35449

Hi,
This is on the list, I just added it a few days ago.

Post count: 201

Excellent, thank you, Calin!

Post count: 144

Hey Calin,
The latest file you provided didn’t actually fix that issue. If you look at lines Line 1286-1294 you do have
if ( empty( $categories_objects ) && $show_siblings ) {
$categories_objects = get_categories(
array(
'parent' => $this->category_obj->parent,
'hide_empty' => 0,
'number' => $limit
)
);
}

However if $this->category_obj->parent is 0, get_categories() returns all top-level categories.

That should be changed to be

// if no child categories get siblings
if ( empty( $categories_objects ) && $show_siblings ) {

// only get siblings if this term has a parent
if ( $this->term_obj->parent ) {
$args = array(
'taxonomy' => $this->term_obj->taxonomy,
'hide_empty' => false,
'number' => $limit,
'parent' => $this->term_obj->parent
);

$categories_objects = get_terms( $args );
}

}

The same issue/behavior exists for taxonomies on Line 1114-1129.

Just hoping this gets incorporated in next version.

Post count: 35449

Hi Nearview,
Thank you for providing the correct solution.
This is now on our list, and we hope our developers will review it and include a fix in an upcoming update, so there will no longer be a need to make changes to the theme plugin files.

Post count: 144

Calin,
So even with 12.7.5 this still is not fixed or included in the theme. The existing Subcategories widget remains untouched, and the new Category Siblings is missing the critical feature of levels of siblings to show. Right now it shows all levels of siblings which is the same issue we have had from the beginning.

Post count: 35449

Hi nearview,
I understand your concern. Everything that could be addressed on my end has already been implemented. Since your last report, two new options have been added in Newspaper v12.7.5:
– include current category
– hide all categories when there are no siblings
If neither of these resolves the issue for you, I apologize, it likely means our developers misunderstood the situation.

Post count: 144

The code you provided previously still works correctly, and addresses the core issue. All we are looking for is for the widget to only show the immediate children, not children, grand-children, grand-grand-children, etc.

Post count: 35449

Hi nearview,
Thank you for the clarification. I understand your requirement. I hope our developers will understand it this time.
I’ve passed this information along to our developers and created a new task for the element update, including the details you provided. This should help ensure that the element only displays immediate children.

Post count: 144

Thanks Calin!

Viewing 15 posts - 26 through 40 (of 40 total)
You must be logged in to reply to this topic.