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

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.
In Chrome, when I look at the code for that element, it looks like this (see red circled area):
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.
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.

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
});

Related

Create second place order button in wordpress checkout page

This may be a strange question, but I want to use 2 of the same buttons on my mobile checkout page in woocommerce. I think this is much better for the user experience because the button to "place order" is pinned to the bottom of the mobile browser so as you can see in the image below.
In my screenshot i made a circle with 2 inside, its on the end of all fields. I think it would be great to create an extra button there.
Is that possible and can that work together? And in what file do I need to edit this?
Really thanks for any help or advise!
As you can see the code for the button is in the next template file
https://github.com/woocommerce/woocommerce/blob/163aaa029dc57b1b04f6ca583bc04c4c4e1b6767/templates/checkout/payment.php#L51
How to Edit Files
Edit files in an upgrade-safe way using overrides. Copy the template into a directory within your theme named /woocommerce keeping the same file structure but removing the /templates/ subdirectory.
Example: To override the admin order notification, copy: wp-content/plugins/woocommerce/templates/emails/admin-new-order.php to wp-content/themes/yourtheme/woocommerce/emails/admin-new-order.php
The copied file will now override the WooCommerce default template file.
Be aware that when moving, the button must still be between the <form></form> elements

wordpress theme - links (relative or hardcoded)

I am using a wordpress theme and am confused about links to other pages.
there are places where I can add a link to an existing button but I am not sure whether the link should be hardcoded or not.
e.g.
www.mysite/wordpress/?page=123
or
?page=123
Also if I have to hardcode it, should I be using https://??
This is not HTML, its like a textbox where you can add a link for a button, I guess the theme provides it.
Here is an image which shows how you can add a link to a button, it askes for a link, I would want to link to my contact page, what should i enter here?
Apologies this is all new to me.
As i know you can hardcode it. Like in Title
I use this code for
<?php the_title();?><?php the_permalink();?>
it will link to the page according to the title of the page/posts.
hope this helps

how to add a function if only a certain template is being used

I'm building a site for a networking group and they want to show if a category is open for someone to join.
I'm not sure if this is possible but I need to add a style to the navigation that if a category is open it will show "open" next to it when you hover over it. I know I can change it but the problem is it needs to be user friendly so they can change it themselves. So I'm trying to figure out a way to make it as easy for them as possible.
So far I came up with the idea of creating a different page template for them to choose and created a hover style for that template. The problem is you have to be on that template page and it shows when you hover over all of them even if it's not open.
Is there a way to add a function for a page only if it's using a certain template?
Here is a link to a page that is using the template I added - http://pt6-dev.info/categories/auto-truck-repairs/
I know some of the basics of php and javascript so any help or ideas would be appreciated!
You can just add it into the PHP file out with the PHP tags using the < script > element

How to edit Wordpress code for a specific page?

I feel kind of stupid asking this but... I have three pages on my website. There is one of them I want to edit. How do I access the code of this page? I need to change the size of a Google Maps I have embedded on the page.
Go edit this page, in the right sidebar look for Template in page attributes box. This page should be using a template, go to your theme folder and look for a php file with the similar name, when you open, it should have the exact template name in the header, that's where you can edit the code of this page assuming that it use a template.
I managed to solve the problem by playing around with some divs in the css.

Finding a content of a page in cms

I would like to remove one of the pictures on this page http://www.seobrand.com/online-reputation-thank-you but when I click edit, the cms doesn't show those contents .Why and how to fix it ?
Your theme is likely using a function like;
get_template_part()
to render that part of the page. dig into your themes files for page.php and see if you can find a call like that. If you modify the template that corresponds with that call you will be able to see the markup and remove the picture from that content.

Resources