• Resolved Fropky

    (@fropki)


    Hi,

    I am getting two css in header. Second header only showing this

    .g{margin:0;padding:0;overflow:hidden;line-height:1;zoom:1}.g img{height:auto}.g-col{position:relative;float:left}.g-col:first-child{margin-left:0}.g-col:last-child{margin-right:0}@media only screen and (max-width:480px){.g-col,.g-dyn,.g-single{width:100%;margin-left:0;margin-right:0}}

    It is an inline CSS in without autoptimize version and we have enabled

    Check this option for Autoptimize to also aggregate CSS in the HTML.

    I was not able to find following code in my server except autoptimize file. Tried following command

    [root@host wp-content]# grep -r “g-dyn” /home/username/example.com/
    /home/username/example.com/wp-content/cache/autoptimize/css/autoptimize_065892e82b11b7e2276dab07a3bdf8a3.css:.g{margin:0;padding:0;overflow:hidden;line-height:1;zoom:1}.g img{height:auto}.g-col{position:relative;float:left}.g-col:first-child{margin-left:0}.g-col:last-child{margin-right:0}@media only screen and (max-width:480px){.g-col,.g-dyn,.g-single{width:100%;margin-left:0;margin-right:0}}

    I don’t how this file getting generated at all. Please help.

    • This topic was modified 5 years, 10 months ago by Fropky.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    If you can share your site’s URL then I can probably tell you @fropki ??

    Thread Starter Fropky

    (@fropki)

    I got the code in adrotate pro plugin. How can I make it compatible with Autoptimize. So that only 1 CSS file is made.

    $output .= “<!– AdRotate CSS –>\n”;
    $output .= “<style type=\”text/css\” media=\”screen\”>\n”;
    $output .= “\t.g”.$adrotate_config[‘adblock_disguise’].” { margin:0px; padding:0px; overflow:hidden; line-height:1; zoom:1; }\n”;
    $output .= “\t.g”.$adrotate_config[‘adblock_disguise’].” img { height:auto; }\n”;
    $output .= “\t.g”.$adrotate_config[‘adblock_disguise’].”-col { position:relative; float:left; }\n”;
    $output .= “\t.g”.$adrotate_config[‘adblock_disguise’].”-col:first-child { margin-left: 0; }\n”;
    $output .= “\t.g”.$adrotate_config[‘adblock_disguise’].”-col:last-child { margin-right: 0; }\n”;
    foreach($generated_css as $group_id => $css) {
    if(strlen($css) > 0) {
    $output .= $css;
    }
    }
    unset($generated_css);
    $output .= “\t@media only screen and (max-width: 480px) {\n”;
    $output .= “\t\t.g”.$adrotate_config[‘adblock_disguise’].”-col, .g”.$adrotate_config[‘adblock_disguise’].”-dyn, .g”.$adrotate_config[‘adblock_disguise’].”-single { width:100%; margin-left:0; margin-right:0; }\n”;
    $output .= “\t}\n”;
    if($adrotate_config[‘widgetpadding’] == “Y”) {
    $output .= “.adrotate_widgets, .ajdg_bnnrwidgets, .ajdg_grpwidgets { overflow:hidden; padding:0; }\n”;
    }
    $output .= “</style>\n”;
    $output .= “<!– /AdRotate CSS –>\n\n”;

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, origin is inline CSS which is not media="all" (or no media specified) but media="screen". AO cannot (and should not) mix CSS of different media-attributes.

    if this CSS is added by you, add it without a media-attribute or with media=”all” and it will be added to the other Autoptimized CSS-file.

    hope this clarifies,
    frank

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, you could change

    $output .= “<style type=\”text/css\” media=\”screen\”>\n”;

    into

    $output .= “<style type=\”text/css\” media=\”all\”>\n”;

    but take into account that with any plugin update you would have to re-do that change ??

    Thread Starter Fropky

    (@fropki)

    Thanks a lot ??

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you’re welcome Fropky, feel free to leave a review of the plugin and support here! ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Two CSS in header’ is closed to new replies.