Code to Only Show Content With Specific URL

169 Views Asked by At

I'm using two shortcode sections in my "Account" page (one Woocommerce for past orders only) and then one shortcode section for MemberPress account details. I want to only show the Woocommerce shortcode section when the URL is /my-account/orders/ .

How do I do this? (CSS preferred if possible)

1

There are 1 best solutions below

0
On

Sorry I can't answer this in CSS but I can with javascript as it is much easier:

  $(document).ready(function() {

   if(window.location.href.indexOf("/my-account/orders")) {
    $(".codeyouwanttodisplay").show();
  }
  });

And if you are hiding the CSS just use:

.name {
 display: none;
}