Easy way to kill all links

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.

Read More

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.

Related posts

Leave a Reply

4 comments

  1. Its a bit difficult to determin what you want to do but….

    You can hide all links using the css

    a {display: none};
    

    Or hit a specific selector or class such as so you would only hide specific links…

    a.wp-link {display: none};
    

    You could also do something using javascript such as

    (jQuery example)

    $("a").attr("href", "#");
    

    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:

    $('a').click(function() {
      alert('Site under development...check back soon.');
      return false;
    });
    

    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.