Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #455533

    Hi

    I have an Enfold child theme and would like to use my own print.css. I created the file themes/mychildtheme/css/print.css and added my print CSS in there.

    However, this isn’t referenced in the header. I only see the default Enfold print.css in the source code of the site:

    <link rel=’stylesheet’ id=’avia-print-css’ href=’https://www.steveparkers.com/wp-content/themes/enfold/css/print.css?ver=1&#8242; type=’text/css’ media=’print’/>

    … I then tried to enqueue my own print.css by using the following code at the end of my theme’s functions.php:

    add_filter( ‘wp_enqueue_scripts’, ‘enfold_remove_css’ );
    
    function enfold_remove_css() {
    
    wp_dequeue_style( ‘avia-print’ );
    wp_deregister_style( ‘avia-print’ );
    
    wp_register_style( 'avia-print',     $template_url."/css/print.css", array(), '1', 'print' );
    wp_enqueue_style('avia-print');
    }

    … But after doing this, I don’t see a change in the source code of the frontend, and the print.css is still linking to the default enfold print.css. Can you see anything obvious I’m missing?

    Thanks in advance!

    Tom

    #455883

    Hi!

    Try changing your code to:

    function change_aviaprintcss() {
       wp_dequeue_style( 'avia-print' );
       wp_enqueue_style( 'avia-print-child', get_stylesheet_directory_uri().'/css/print.css', array(), '2', 'all' );
    }
    add_action( 'wp_enqueue_scripts', 'change_aviaprintcss', 100 );

    Regards,
    Josue

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.