• Hi
    So, I’m trying to edit foot.php in order to add analytics code to all pages at once, however when I hit Savé Changes I go directly to my webpage and a page not found appears.
    First I thought “OK, this can be a theme problem”, so I changed the theme to one of pre-installed from WordPress but the same problem happens.

    Does anyone has a solution for this?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • You don’t say what theme you are using but generally the advice is to avoid editing theme files as they may be overwritten by updates.

    Probably it will be easier to use a plugin to add the code. There seem to be several to pick from.

    To do it by coding, I would setup a child theme and then enqueue the script with a snippet in functions.php for the child theme:

    <?php
      add_action( 'wp_enqueue_scripts', 'add_my_script' );
      function add_my_script() {
        wp_enqueue_script( 'my-js', '/wp-content/uploads/my_script.js', array(), "1", true);
      }

    The snippet should add a line to each page to load the script in the footer.

    Thread Starter joaosacramento

    (@joaosacramento)

    Hi
    The problem was from host.

    I contacted the host support and it’s fine now.

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Edit footer.php returns page no found’ is closed to new replies.