[Support request] Footer element generating inline CSS

Home Forums Support [Support request] Footer element generating inline CSS

Home Forums Support Footer element generating inline CSS

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1816826
    Rekindle

    Hi,

    I’m in the process of migrating our site to GeneratePress + GenerateBlocks, and I’m loving my experience so far.

    I’ve created a footer element using GP + GB. Both GP and GB are set to print CSS to an external file. But for some reason, on some pages, the footer’s CSS is being printed to an external file, but on some others, it prints it correctly to an external file.

    Page with inline CSS: https://snipboard.io/TLtvbz.jpg (it’s behind a login)
    Page with external CSS: https://snipboard.io/s5NMdA.jpg (link to page)

    Why is this happening? How can I make sure that it always prints CSS to an external file?

    Thanks!

    #1817755
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    The plugin isn’t always able to create an external file – some pages simply don’t allow it (mainly ones without a page ID, like dynamic pages). In those cases, it will default to printing inline.

    However, the external file/inline embedding shouldn’t really matter if you use a plugin like Autoptimize (or any caching plugin) that compiles all of your CSS in one CSS file. That may be the way to go here?

    Let me know 🙂

    #1818052
    Rekindle

    Hi Tom, thanks for the explanation. Maybe I’ll explain what I’m trying to do so you can let me know if there is a GP-way of solving this.

    We have a webpage being dynamically generated for each user using PHP at the backend. (It therefore doesn’t have a page ID, and that explains why it ends up with inline footer CSS). Before GP + GB, the PHP and the associated CSS was hand-coded. I’m trying to get rid of as much hand-written CSS as possible for easy maintenance.

    What I did was to create that page design using GB, went to the source HTML, and copy-pasted sections of that back into the HTML file. I copied GB’s dynamically generated CSS file into the plugin folder. Everything works well, except some of this inline footer CSS is overriding rules in the external CSS.

    The only solution I can think of is for me to manually change some of the rules in the external file, but this will make maintenance more difficult. Is there a neater solution to this problem?

    Thanks!
    p.s. I love your support forum! I have searched a ton of my queries using site:generatepress.com (also similarly for GB) and I’ve found answers for every one of them.

    #1818924
    Tom
    Lead Developer
    Lead Developer

    except some of this inline footer CSS is overriding rules in the external CSS.

    If this is a static HTML page, how is the inline footer CSS being added? Any chance you can show me a screenshot of this CSS in the source?

    Just to confirm, you have a static HTML page (not WordPress), and you’ve added the HTML and CSS from a GenerateBlocks page to it?

    #1819383
    Rekindle

    Hi Tom,

    I see what you mean. To clarify, this is not a static HTML page (I’m not a developer so I used that word wrongly). It is a WordPress page with a shortcode in it. The content for that shortcode is being generated by a custom plugin. So this page does have an ID on the backend.

    So what I did was create another page using GB that would look like how I want the original page (we call it the Today page) to look. I then copied the HTML bits from the GB page, stuck it into the plugin, saved the CSS file under a different name and hoped it would work. But the Today page has inline CSS for the footer – I’m not sure why. You can see screenshots and login info below.

    Thanks again.

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