0

I'm having problems executing some javascript within a certain part of my WordPress front page I created. I want to execute a welcome message within this div.

<section class="showcase">
    <div class="container">
        <div class="page-banner__bg-image" style="background-image: url(<?php echo get_theme_file_uri('/images/library-hero.jpg') ?>);"></div>
            <div class="page-banner__content container t-center c-white">
                <h1 class="headline headline--large">Welcome!</h1>
                <h2 class="headline headline--medium">We can help your <strong>business</strong></h2>
                <h3 class="headline headline--small">grow with better workflow solutions.</h3><br>
                <a href="<?php echo get_theme_mod('btn_url', 'http://www.web2dezine.com/services/'); ?>" class="btn btn-primary btn-lg"><?php echo get_theme_mod('btn_text', 'Look Here'); ?></a>
            </div>
    </div>

wp_enqueue_script( 'webpromo_welcome', get_template_directory_uri() . '/src/js/welcome.js', array( 'jquery'), '20170115', true );

I want to replace the h1 welcome with the welcome.js file to be executed using the wp_enqueue_script?

Rammy7219
  • 27
  • 2
  • 8
  • What problem do you have?Did you tried to put your script directly inside your page? – dwpu May 06 '19 at 20:10
  • If you want to load the script in your header you need to remove the `true` from your `wp_enqueue_script()` – dwpu May 06 '19 at 20:13
  • No I want to execute the js file where the

    is but can't find a work around it. It executes in the footer but that isn't where I want it showing.

    – Rammy7219 May 06 '19 at 20:19
  • why do you want to add js script exactly at that line? what should do your script? – Samvel Aleqsanyan May 06 '19 at 20:37
  • I want it to be dynamic so it will react to the time of day, like "Good morning" "good afternoon" or "good evening" when someone lands on the page. – Rammy7219 May 06 '19 at 20:42

0 Answers0