body onLoad on a specific WordPress page

前端 未结 3 1609
一生所求
一生所求 2021-01-25 07:53

Using the latest Wordpress version (3.6), I am trying to apply:


To a specific landing page on my

3条回答
  •  无人及你
    2021-01-25 08:20

    You don't need to apply the code to the tag, see: https://stackoverflow.com/a/191318/1287812

    This can be done in functions.php with the following code, and using the conditional tags mentioned by SrikanthAD:

    add_action( 'wp_footer', 'b5f_on_load_script' );
    
    function b5f_on_load_script()
    {
        // Not our page, do nothing
        if( !is_page( 'about' ) )
            return;
    
        ?>
        
        

    Also see: How to use window.scroll to automatically scroll on pageload?

提交回复
热议问题