End Body Tag

Can you show me how to put a code just before ‘end body tag’ I’ve read in older posts you need to access the child theme ftp, I know where my ftp is in cPanel, is this the same thing? How do I know it’s child.


The best way to do this is using the wp_footer hook with a really late priority. Something like this:

function my_custom_code() {
  echo '<!-- your code -->';
add_action('wp_footer', 'my_custom_code', 9999 );

Thank you. I added a header/footer plugin out of ease.

I like to try keep plugins to a minimum, for future reference -

Where do I add this to in the cPanel and how do I do with a child theme?

Many thanks

Hello There,

Thanks for updating in! Because what you are trying to accomplish requires a template customization, we would highly to suggest that you use a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

After the child theme is set up, please go to Appearance > Editor and click on the functions.php file in right right side. You can then add the following code

function my_custom_code() {
  echo '<!-- your code -->';
add_action('wp_footer', 'my_custom_code', 9999 );

If ever you are not allowed to edit the theme files within your WP dashboard, you will have to login to your ftp and browse to the folder wp-content/themes/x-child/ and download to edit the functions.php file.

Hope this helps.

This is where I start to feel out of my skill set so please be patient and apologies in advance.

My initial plugin is not working so I have to add code manually to footer.

Q1. I’ve had a child theme from the start. I’ve been using the customise CSS global section to make changes to the theme (H2 sizes etc) but I’ve done this directly on customise, is this wrong, should I making those additions somewhere else?

Q2. Inserting code into footer. When I click on Appearance/Editor the coding says


Theme Name: X – Child Theme
Theme URI: http://theme.co/x/
Author: Themeco
Author URI: http://theme.co/
Description: Make all of your modifications to X in this child theme.
Version: 1.0.0
Template: x


does this seem correct?

I’ve located ftp and added the code removing but keeping ’ ’ Correct? The code is showing in Page Inspect on Chrome.

Many thanks!

Hi there,

  1. Your approach is completely correct, you have both the choice of customizer and the child theme for styles. But regarding the customization we suggested in this thread it is a PHP code and you cannot add such a code in customizer and you need to use the child theme.

  2. if you want to add the code to the Chive theme you need to add it to functions.php file. That file can be access via FTP by going to: wp-content/themes/x-child/functions.php

If you want to access the file using the WordPress Dashboard please kindly go to Appearance > Editor and from the right section of the screen click on functions.php:

Thank you.

1 Like