• Good morning, 1st Post thus pls excuse me if i make any mistakes.
    I’m trying to load an additional css file in single.php. For exaple if single.php load css file, else go to next line. Can someone please advise.
    Also do it put this in header.php or in functions.php

Viewing 2 replies - 1 through 2 (of 2 total)
  • I understand.. u r in some problem exactly I was one day…
    https://wordpress.org/support/topic/how-to-add-contents-in-wp-header-for-a-custom-post-template
    I didn’t find the answer I expected so I did this…
    Edit single.php> remove <?php get_header(); ?> then copy codes from header.php and posted in single.php (where <?php get_header(); ?> was. then u can freely add something in header. But again, It is not the appropriate answer

    Instead of loading an additional css file why not just use the body classes to target elements specific to that type of page?

    <body class=”single single-post postid-324″>
    </body>

    WordPress inserts these tags for you so its nothing you will even need to change.

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

The topic ‘Run CSS on specific templates’ is closed to new replies.