• I am tring to create a theme and here I stacked. I want to add a slider in homepage only. o it is pointless to add that css in styles.css. I created a file in theme/layout/slider.css. my homepage is static page. I want to add slider.css for my homepageonly (obbhome.php).
    Here is my code.

    <?php
        add_action('wp_head', 'slider_css');
        function slider_css(){
    ?>
    
    <link rel="stylesheet" type="text/css" href="<?php echo get_template_directory_uri(); ?>/layouts/slider.css">
    <?php
       }
    ?>

    But it doesn’t work. nothing happen. so how to add some code in head tag?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to add some code (guess css) in header?’ is closed to new replies.