This topic has 2 replies, 3 voices, and was last updated 9 years by Abe.

  • Author
  • #18534
     radleaf
    Participant

    I am trying to add code to my /kleo-child/functions.php:

    COPY CODE
    if(is_front_page()) {
    function injector() {
        ?>
        <script type="text/javascript">
            jQuery(document).ready(function() {
                console.log("Front");
            });
        </script>
    
    <?php
    
    }
    
    add_action('wp_footer', 'injector',105);
    }

    I want the ability to add code using conditional tags within my functions file of my child theme. Can you help me out with this

    #18586
     sharmstr
    Moderator

    Google is your friend: http://wordpress.stackexchange.com/questions/41805/is-front-page-only-works-in-theme-file-and-does-not-work-in-functions-php

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #18661
     Abe
    Keymaster

    Hi, it works by WordPress instruction. Probably in the functions.php the system does not know yet what template will be loaded so you can put your code in a action like add_action(‘wp_head’, ‘your_function’); and in the function your_function() {} add the code

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?