• Resolved danicalc

    (@danicalc)


    Greetings! Is it possible to specify CSS specifically for the amp pages? I have embedded PDFs on several posts that are loading with errors on the AMP pages. I would like to hide them from the AMP pages so that the error isn’t visible. Thank you!

    • This topic was modified 5 years, 1 month ago by danicalc.
Viewing 3 replies - 1 through 3 (of 3 total)
  • @danicalc If you are using AMP in transitional or standard mode you can add the below to your themes style.css file. By using the [amp] selector it will ensure the rules only apply to AMP URLs.

    html[amp] #page { 
    background-color: red; 
    }

    If you are using AMP in reader mode your themes style.css does not apply, so you will need to add the below to your active themes functions.php file.

    add_action( 'amp_post_template_css', function() {
            ?>
            /* Put Custom CSS here */
            <?php
    } );
    Thread Starter danicalc

    (@danicalc)

    Thanks very much! I’m sorry this reply got caught in my promotions folder and I’m just seeing this now.

    James Osborne

    (@jamesosborne)

    @danicalc No problem, hopefully it works for you. And if you find the plugin works well for your site feel free to leave a review.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide div or class on AMP pages’ is closed to new replies.