Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #143813

    GDM-Pixel
    Participant

    Hi Lisa,

    you’re right, the tip I gave was pointless as we canno’t declare a function in a child theme (tried a bunch of stuff, but I really suck at PHP and none worked)

    I thought it was working cause I have a reverse proxy in front of my server, and it didn’t update the request.

    But when the cache refreshed, then I understood I was wrong 🙁

    So for now, I just comment the add_action( 'wp_head', 'x_customizer_options_output_css', 9998, 0 ); line and I’m fine.

    10 seconds to do, and the theme isn’t updated that much so…doesn’t really bother me. although it would be very fine if we could overcharge the main theme function with the child’s function.php…

    #144088

    Rubin
    Keymaster

    Hey There,

    That “tweak” seems to be the best solution. Overcharging the main theme is a bit tricky and unclean so I wouldn’t recommend it.

    #170464

    jbellsey
    Participant

    Yes please… another vote for the solution proposed by Lisa S.

    In the meantime, here’s a safer way to remove the inline CSS generated by the customizer. As mentioned above, beware of using this technique, as it completely removes the styles, so you need to ensure that you manually manage the external style sheet for your users.

    function remove_inline_customizer_css () {
        remove_action( 'wp_head', 'x_customizer_generated_css_output', 9998);
    }
    add_action('after_setup_theme', 'remove_inline_customizer_css');
    

    Because the child theme is loaded after the parent, we can’t call remove_action until after the theme has been set up. This is why the call is deferred in the code above. Also, be sure to keep the priority (9998) in the call to remove_action.

    [Edit] Just to be clear: the code above should go in your child theme. By putting it there, you do not need to edit the parent (X) theme files, which is generally a Very Bad Thing™ to do!

    #170542

    Christian
    Moderator

    Thanks for sharing a workaround. 🙂

    #253245

    hluijken
    Participant

    I dont get it, do I need to adjust changes in the stylesheet manually after jbellseys workaround above? This seems a major flaw for X theme which I purchased based on their claim on SEO friendliness and wysiwyg. I am a newbee with WordPress and Xtheme, and thought an extrenal stylesheet was standard business. What is my best option now, back to dreamweaver?

    #253361

    jbellsey
    Participant

    My workaround (above) is designed to sever the customizer entirely. I use the customizer only as a starter tool, since I’m a programmer who prefers to manage CSS in code. So don’t use my fix until you’re ready to do that yourself, as you will lose the WYSIWYG editing capability.

    I can’t tell you whether or not to switch to another solution. X theme — like Dreamweaver and Squarespace and every other system — makes compromises to balance multiple competing needs. Your site won’t be banned from Google for 10k of inline CSS. It’s just one factor among many. Obviously the customizer would be better if it output an external CSS file rather than inline CSS, but it’s not a show-stopper IMO.

    Then again, I do hope the developers change this design decision.

    #253433

    Rad
    Moderator

    Hey guys, I hear you 😉 already forwarded this for checking. I know externalising css could contribute to speed, but my question is does css really affect seo? Isn’t search engines ignore non-content section all at once? Though yes, as personal preference, I’ll choose externalised css 🙂 Thanks!

    #287674

    Hi there,
    thanks for your trick GDM-Pixel!
    I tried this on new V4 and for some reason it works when I commentthe bottom line of /x/framework/functions/global/admin/customizer/output.php
    but I got a blank page when I copy / paste the code in the function.php of my child theme.
    Any idea ?

    #287997

    Christian
    Moderator

    Hey there,

    Please remove the code you’ve added and check it with http://phpcodechecker.com/ to see if there’s a syntax error.

    Thanks.

    #293196

    lhd333
    Participant

    Can any of this be accomplished with a custom plugin or extension?

    I wonder if there are any customer/developers out there that would be willing to build this?

    #293912

    Rad
    Moderator

    Ah, nice suggestion! I like the idea too. We will see if we can have something like that in the future 😉

    Thanks!

    #396112

    Bart971
    Participant

    Yes please… another vote for the solution proposed by Lisa S.

    In the meantime, here’s a safer way to remove the inline CSS generated by the customizer. As mentioned above, beware of using this technique, as it completely removes the styles, so you need to ensure that you manually manage the external style sheet for your users.

    
    function remove_inline_customizer_css () {
        remove_action( 'wp_head', 'x_customizer_generated_css_output', 9998);
    }
    

    add_action(‘after_setup_theme’, ‘remove_inline_customizer_css’);
    Because the child theme is loaded after the parent, we can’t call remove_action until after the theme has been set up. This is why the call is deferred in the code above. Also, be sure to keep the priority (9998) in the call to remove_action.

    [Edit] Just to be clear: the code above should go in your child theme. By putting it there, you do not need to edit the parent (X) theme files, which is generally a Very Bad Thing™ to do!

    Excellent suggestion @jbellsey! My page increased 14% ratio code/text! Now i have 45% ratio code/text with a 1450 words article 😉

    You rock!
    Best Regards!

    #396297

    Christian
    Moderator

    Thanks for sharing, Bart.

    #805529

    Elinor
    Participant

    Great solution, everyone. Great help from the community and from Themeco.

    This is in response to a comment made above by Themeco staff on CSS and SEO:

    Themeco Staff: You have a great theme, but I think it’s important to understand the following. First: This isn’t a critique of Themco or X Theme. Great theme! I think we’ll be seeing a lot of themes focus on performance, and I think developers would be happy paying double or triple to have a site that really meets this mark. I would.

    https://developers.google.com/speed/docs/insights/rules

    above a Themeco Staff MEmber asked the following: “Hey guys, I hear you 😉 already forwarded this for checking. I know externalising css could contribute to speed, but my question is does css really affect seo? Isn’t search engines ignore non-content section all at once? Though yes, as personal preference, I’ll choose externalised css 🙂 Thanks!”

    Here is the answer:

    The question “Does CSS impact SEO” is not actually an accurate way of phrasing a question. This is absolutely, 100%, not a matter of personal preference. There are two entities who require your site to perform well. Google (yea yea and other search engines) and website users.

    It isn’t CSS as an entity that impacts SEO. Code bloat impacts performance which is a ranking factor therefore impacts SEO.

    Fact: Performance is not a feature. It’s a KPI. Period.
    Fact: Performance is a ranking factor. A big one. Google would like your website to load in UNDER 1.5 seconds. Check it out for yourself!
    Fact: This is not easy. Themes are (no offense, this is a good theme) bloated especially in regards to performance as, hey, you have to stuff it with snazzy features so people will buy it. A savvy developer has to use everything at their disposal to get page load times down. Time to First Byte! It’s a big deal. Site performance – and I watch this across a pretty large number of websites that I manage – impacts the bottom line (actual business impact) far more than a parallax image or neat slideshow does.

    So, we focus on removing inline styles and scripts, using css sprites, leveraging a CDN, minifying the css and js, leveraging browser caching, removing render-blocking javascript etc. The more a theme can support this, the better!

    It’s not a moot point. Slow websites see higher bounce rates and lower session times than they should be because users pogo stick back to the SERPs when the site takes 3,4,8 seconds to load. Google DOES judge your website on it’s performance and pogo-sticking does not go unnoticed.

    Test: Run page speed insights.
    https://developers.google.com/speed/
    Advanced: User Fiddlr or Charles to debug further.

    Question: How many calls are you making to the server to load the page? Probably too many. Users do not like slow websites, and therefore neither does Google – increasingly so.

    Again, this is not a critique. X is a great theme and does an absolutely superior job for what themes are supposed to do, and at a VERY SMALL COST. Great forum, great support. I’ve recommended this theme to many. As stated, please free to add an extra-fast version with less flashy stuff. Go ahead and charge double or triple…and I’ll buy it. I think you’ll be surprised at how many will.

    Best to everyone!

    #805547

    Elinor
    Participant

    As an append my SEO soapbox above: Is this still working for everyone? I’m in Output.php and things seem to have changed.

    function remove_inline_customizer_css () {
    remove_action( ‘wp_head’, ‘x_customizer_generated_css_output’, 9998);
    }
    add_action(‘after_setup_theme’, ‘remove_inline_customizer_css’);

    Let me know!