I want to display a confirmation screen and a transmission completion screen using contactform7.

Error message
Confirmation screen and transmission completion screen (thanks page) will not be transferred.
Applicable source code
Source code

Plug in Contact Form 7 add confirm,

In functions.php

The contents of functions.php are as follows.

<? php
add_theme_support ('post-thumbnails', array ('page', 'post'));

<? php
register_sidebar (array (
'name' =>'New widget',
'id' =>'test',
'description' =>'New widget area',
'before_widget' =>'Text I want to write before the widget',
'after_widget' =>'Text I want to write after the widget',

&lt ;?
add_the_support ('menus');

<? php
//from here
add_action ('wp_footer', 'mycustom_wp_footer');
function mycustom_wp_footer () {
<script type = "text/javascript">
  if (jQuery ('. wpcf7'). length) {Check if // form class exists
    var wpcf7Elm = document.querySelector ('.wpcf7');
    wpcf7Elm.addEventListener ('wpcf7mailsent', function (event) {
     location.replace ('http: // localhost: 8888/wordpress/contact/thanks /');
   }, false);
<? php
//So far

Is the confirmation screen and the transmission completion screen displayed after caching?
I tried it

It does n’t work.

Supplemental information (FW/tool version etc.)

WordPress version 4.9.8
Contact Form7 version 5.0.3
Contact Form7 add confirm version 5.1
Contact Form 7 Controls version 0.6.1

Thanks for your advice.