Is there an easy method to kill all links on a WordPress page? I’m basically stripping down the twenty-eleven theme and pulling it in a simple iFrame on my site to act as a simple news feed. I want to kill all the links, eg – currently, by default, the WordPress Post titles link to the stand alone posts; just wondering if there’s a simple way to void those links with a CSS snippet I can throw in the header, or style sheet.
Edit: To be specific, I want to keep the text of those default links. Just not have them link, so I think display: none;
wouldn’t work.
I know I could do it manually, just always on the lookout for little tricks – as I feel there could be one, since I don’t want any active links on the page.
I guess jQuery could do that for you with something like:
CSS cannot control this, other than hiding all of the links. You’d need to use JavaScript for this….or edit the PHP source.
Its a bit difficult to determin what you want to do but….
You can hide all links using the css
Or hit a specific selector or class such as so you would only hide specific links…
You could also do something using javascript such as
(jQuery example)
This would replace all link urls with a # or what ever you want – so you could also set a redirect.
Finally you could so somthing more sophisticated:
That (untested) would show an alert if a link was clicked and prevent its default action.
Note all these seem very ‘hacky’ and if it is a short term fix while you are developing would be acceptable but if you are looking at a long term solution it seems like you need to have a more indepth look at your wordpress set up.