• Resolved futureyoon

    (@futureyoon)


    Hi

    I am thinking of migrating from code-snippet to your plugin.

    I was testing one of php scripts that i have but it is not working somehow, maybe some lines to be cleaned up, not sure.

    <?php
    add_action( 'wp_head', function () { 
    if (is_page ( array( '93285','93389' ))) {
    ?>
    <script>
    
    	jQuery(document).ready(function() {
    		
    		if ((window.pageYOffset) > 74) {	
        		jQuery('header.site-header.site-header--bb').css('background-color','white');		
     		}		
    	
    	});
    	
    	jQuery(document).ready(function() {
    		window.onscroll = function() {
    			var yposition = window.pageYOffset 	
    			if ((yposition) < 74) { 
    				jQuery('header.site-header.site-header--bb').css('background-color','#ffffff38');			
    			}
    			else {
    				jQuery('header.site-header.site-header--bb').css('background-color','white');		
    			}		
    		}
    	});
    </script>
    
    <style>
    	.site-header {
        background-color: #ffffff38;
    }
    </style>
    
    <?php } });
    
    add_action( 'wp_enqueue_script', function () {
    	wp_enqueue_script( 'jquery' );
    } );
    

    Can you guide me what to be adjusted?

    One suggestion tho

    Can you add a sample code for each different types (php, javascript, universal, html, block..) for beginners like me to get some ideas how it should look like?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Migrating from code-snippet’ is closed to new replies.