How can I move this to the Child Theme CSS?

  • sanuja.com

    #7517

    I feel dumb for asking this, because this should be obvious to me. But I tried and couldn’t figure this out. I have the following code in Graphene options CSS place.

    /*
    REMOVE TITLE IMAGE/ADS FROM PRINT
    */
    @media print
    {
    #header {display: none;}
    #dynamic-to-top {display: none !important;}
    .adsense_single {display: none;}
    .wp_rp_wrap {display: none;}
    .add-this-right {display: none;}
    }

    Is it possible for me to move all of this code to the Child Theme CSS? How can I modify the @media print? I just copied this and pasted it and it in Child Theme CSS won’t work.

    Thank you.

    Prasanna SP

    #38533

    Create a print style sheet in child theme, say, custom-print.css and add this,

    #header {display: none;}
    #dynamic-to-top {display: none !important;}
    .adsense_single {display: none;}
    .wp_rp_wrap {display: none;}
    .add-this-right {display: none;}

    Register the print style sheet, (this goes in child-theme functions.php)

    function register_custom_print_style(){
    if ( ! is_admin() ){
    wp_register_style( 'custom-print', get_stylesheet_directory_uri() . '/custom-print.css', array( 'graphene-stylesheet' ), false, 'print' );
    }
    }
    add_action( 'init', 'register_custom_print_style' );

    then enqueue it on single posts/pages,

    function enqueue_custom_print_style() {
    if ( is_singular() ){
    wp_enqueue_style( 'custom-print' );
    }
    }
    add_action( 'wp_enqueue_scripts', 'enqueue_custom_print_style' );

    sanuja.com

    #38534

    Thanks Prasanna. I didn’t know this take that much work.

    Would you recommend doing all this modifications? Is it worth it or just leave this code in the Graphene Options as it is?

    The only reason why I thought of moving it was that Ken told me in one of his posts that Child Theme items loads once while the CSS in the Graphene options loads each and every time. However, if this much code has to go into PHP files and such, I don’t know if moving this short codes to the child will have any positive impact on the load times of the site.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.