Adding Custom JS + CSS to header

Hi there,

I’m trying to integrate this jquery lib with PRO.

http://crkl.hu/wp-content/twentytwenty-master/

I need to add this to the header (well not necessarily like this, but this is what I found. Basically 2 css and 2 js files):

add_action( 'wp_head', 'adding_scripts_to_head', 10 );

function adding_scripts_to_head(){
    echo "<link rel=\"stylesheet\" media=\"screen,projection\" href=\"wp-content/twentytwenty-master/css/foundation.css\" />
    echo "<link rel=\"stylesheet\" media=\"screen,projection\" href=\"wp-content/twentytwenty-master/css/twentytwenty.css\" />
    <script type=\"text/javascript\" src=\"wp-content/twentytwenty-master/js/jquery.event.move.js\"></script>
    <script type=\"text/javascript\" src=\"wp-content/twentytwenty-master/js/jquery.twentytwenty.js\"></script>
};

However, if I add it, it breaks the page with error 500. What am I doing wrong?

Hi,

Please update your custom code to this:

function adding_scripts_to_head(){
	?>
<link rel="stylesheet" media="screen,projection" href="wp-content/twentytwenty-master/css/foundation.css" /><link rel="stylesheet" media="screen,projection" href="wp-content/twentytwenty-master/css/twentytwenty.css" /><script type="text/javascript" src="wp-content/twentytwenty-master/js/jquery.event.move.js"></script><script type="text/javascript" src="wp-content/twentytwenty-master/js/jquery.twentytwenty.js"></script>
	<?php
}
add_action( 'wp_head', 'adding_scripts_to_head' );

Hope it helps :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.