Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

How to add js on click alert event to all post title links WordPress

I need a way to to have any post with a specific custom field show a js alert when the link to the post is clicked in order to alert the reader that the post contains adult content ahead of the post being loaded for them to read. I need it to be something I can add to my functions.php to make sure all linked post titles check for this custom field and display the alert if the custom field is found.

Answers (5)


Peter Michael answers:

All you need is here: [[LINK href=""]][[/LINK]]


S├ębastien | French WordpressDesigner answers:

please, could you increase your fee.
10$ seems a good fee


Khang Minh answers:

You can't do this with functions.php, in my opinion, but rather with the template files you use to show post titles. Are you using jQuery on your site? So you just want to tell your visitors that the post contains adult contents but you don't want to give them any option? You know, like 'Proceed' and 'Nah, I'm still a kid'?


Nilesh shiragave answers:

You cant do this with a filter inside your themes functions.php to achieve this you have to edit all post titles anchor tag you have to add additional class to anchor tag.

Then using javascript you can add alert box.


Christianto answers: