Need some help with custom jQuery please

I'm using a directory theme that outputs both taxonomies and single listings dynamically on the same page, like so:
domain.com/main-directory
domain.com/main-directory/taxonomy
domain.com/main-directory/taxonomy/individual-listing

I'm am trying to have some textual content appear only on the first taxonomy "display" of that page. So I've added some paragraph elements with unique selectors, yet they all appear on all taxonomy & single listing URLs, because all the above URLs use the same page and HTML elements. So I can't use just good ol' CSS to hide stuff on inner "pages", so need to use jQuery... or any other option you can think of.

In a couple of live chat sessions, this is what we have tried:

if (document.location != 'https://domain.com/main-directory/') {
document.querySelector('#first-intro').style.display = 'none';
document.querySelector('#second-intro').style.display = 'none';
document.querySelector('#third-intro').style.display = 'none';
}

But just can't seem to get it to work on the 2nd of the inner "pages". The above allows the specified elements to display as they should on the "main" display - https://domain.com/main-directory/ - and hides them on the 2nd "display - domain.com/main-directory/taxonomy - but they stubbornly refuse to be hidden on the 3rd "display" - domain.com/main-directory/taxonomy/individual-listing

  • Predrag Dubajic
    • Support

    Hi Mary,

    We were checking this further but it's not clear why the code refuses to work on your site so we had pinged our devs to check it out as well and see if there's any quick solution for this.
    Please note that developer response might be slower than usual staff response, so we appreciate your patience on this.

    Best regards,
    Predrag

  • Konstantinos Xenos
    • Rubber Duck Debugger

    Hi mary ,

    Could you tell me where/how did you add that jQuery snippet exactly? I'd also like to have access to files as well so I can help you out with this.

    You can send me the information needed privately through our contact form: https://premium.wpmudev.org/contact/#i-have-a-different-question by following this example:

    Subject: "Attn: Konstantinos Xenos"
    
    - Admin login ( if Multisite please provide Super Admin details ):
    Admin Username:
    Admin Password:
    Login URL: 
    
    - FTP credentials
    Hostname:
    Username:
    Password:
    Port:
    Key-File ( and password ) if needed
    
    - Link back to this thread for reference
    - Any other relevant URLs -or- information regarding the issue that was not included in this thread

    Regards,
    Konstantinos

  • mary
    • Site Builder, Child of Zeus

    Hello!

    Unfortunately, my deadline to accomplish this passed, as the directory had to be ready for presentation at a large meeting last night. So the code is no longer there. I had to place the text in question on a separate page, which is not ideal, but I can't really change it back at the moment, though I might be able to after November 1. Thanks for offering to help.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.