36

How to Hide Empty Related Listings Tabs in MyListing Websites

Powered by WPCodeBox

Improve your MyListing website’s user experience by hiding empty “Related Listings” tabs with this efficient code snippet. Reduce distraction and streamline your site’s navigation by only displaying relevant content.


/**
 * Author: MyListing Club
 * Author URI: https://mylisting.club
 */

jQuery(document).ready(function ($) {
  $(
    ".profile-header .profile-menu ul li a.toggle-tab-type-related_listings .items-counter"
  ).each(function (index, el) {
    setInterval(function () {
      if ($(el).text() == "0") {
        $(el).closest("li").hide();
      }
    }, 500);
  });
});

Other Snippets

WPCodeBox is a WordPress Code Snippets Manager that allows you to share your WordPress Code Snippets across your sites.