I have bought a wordpress theme called Salient : http://themenectar.com/demo/salient-frostwave/home-basic/
It has this AJAX search (little search icon in the menu) and I want to remove any search results from the list that has a certain href value, say “portfolio” in it.
I have tried with adding following code as a “raw html element” inside script tags in the page builder plugin but it did not work
$('a[href*="portfolio"]').css.({display:"none"})
How to I implement this on wordpress?
Update :
Thanks for all the answers. There was a “.” after “css” and the correct line should be :
$('a[href*="portfolio"]').css({display:"none"})
Now I need to know how to select and hide all other elements that does not contain “portfolio”. i.e. the end result will only have the items with “portfolio” in it.
I tried
href!="portfolio"
But it does not select any because != matches the exact and only “portfolio” where as my “portfolio can be anywhere in the link.
To hide all elements that does NOT contain the word portfolio:
You don’t even need jQuery for this, add this to your
CSS
file:a[href*="portfolio"] { display: none }
Example: http://codepen.io/anon/pen/vNvrpG
Why everybody write another code? There is a dot after css function, clear it. Replace with :
You probably don’t have jquery, you can import it by adding this to HTML
So you can use your code
$('a[href*="portfolio"]').css.({display:"none"});
Or you can use javascript (adapt as needed):