MyListing Club

Hide Related Listings Tab If Empty

Building better MyListing websites. One code snippet at a time.

Overview

The Hide Related Listings Tab If Empty code snippet provides additional functionality for MyListing websites.

This snippet is useful to provide less of a distraction to users, while not showing them an area of your website that’s empty with no usable actions or data.

Implementation

  1. Grab the code snippet.
  2. Follow the provided instructions.
  3. Save your changes.
				
					//// INSTRUCTIONS: 
//// Copy and paste the code snippet below into Theme Tools > Theme Options > Custom Code > JavaScript.

--------------------------- CODE SNIPPET IS BELOW THIS LINE --------------------------- 

// HIDE RELATED LISTINGS TAB IF EMPTY
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);
  });
});