JakeSays
JakeSays

Reputation: 2068

Access to WordPress page code not accessible or seen in admin dashboard?

We have a website developed in Wordpress by a third party. We need to add a java script function and onClick event to an individual page of our website.

The page has a div with some divs that mimic a button. They are just text with anchor tags, inside divs. We are particularly interested in one particular one. (i.e. $2.00 Off Coupon) which when clicked downloads a PDF document. We would also like it to call a function.

$2.00 Off Coupon

In Chrome, when I look at the code for that element, it looks like this (see red circled area):

enter image description here

With in the WordPress admin dashboard, the code for those buttons is not available, as it was custom made by the third-party developer.

e.g.

enter image description here

My Question is, is this code in a template, theme, or page code stored in database? How can I modify this anchor tag to include an onClick event to call the function I need?

Any help to guide me in the right direction would be much appreciated as I am a WordPress Novice.

Upvotes: 0

Views: 108

Answers (1)

Z. Dmitry
Z. Dmitry

Reputation: 321

I think this code located in Page Template file in your WordPress theme. Try to find file with name page-home.php of something else. This file should start from this code:

<?php 
/* 
Template Name: Home
 */

Or try a bad solution to the problem

$('.home-ctas').on('click', 'a[data-emalabel="$2.00 off coupon"]', function(){
    // your function
});

Upvotes: 1

Related Questions