• Hi
    I support a simple website built in WP. It works nice until I need to get to the client code a little more deeply.
    I need to add “onclick” html attribute to all anchors on the page and don’t figure out how to do it.
    Reminder: it’s not CSS and I don’t really want to run over anchors by jQuery after all the site is on.
    Thanks. I will very appropriate for any help with WP or a plugin can help.
    Victor

Viewing 5 replies - 1 through 5 (of 5 total)
  • Sorry, I do not understand your question.

    Could you post your web address here, and describe in details what you want to see and be able to do.

    Thread Starter Doc999tor

    (@doc999tor)

    Sorry, the site isn’t published yet.
    But.
    The site manager (non-a-programmer) adds simple links with href to some places on the page. href=”#like”
    I need to add onClick attribute to those links.
    I know WP creates the links in PHP wherever, I need to change the way it happens.
    Hope it was brighter explanation 🙂
    Thanks!

    The onclick attribute belongs on the link which is clicked and jumps to your mark in the page. It does not belong in the target.

    Adding onclick to your links depends upon just where and how they are they are generated, this makes it difficult to give you directions.
    My only suggestion is to use a filter.

    Thread Starter Doc999tor

    (@doc999tor)

    What do you mean “a filter”?

    WordPress has a scheme of filters and action hooks (they are similar), which enables you to modify the pages as they are generated.

    As parts of your page are generated the text is offered to various filter actions, they can modify the text before it gets sent to the client’s browser.

    More details here:
    http://codex.wordpress.org/Plugin_API/Filter_Reference

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to add onclick attribute to all anchors?’ is closed to new replies.