- This topic has 4 replies, 2 voices, and was last updated 7 hours, 56 minutes ago by Rekindle.
June 9, 2021 at 6:05 pm #1816826Rekindle
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.
Why is this happening? How can I make sure that it always prints CSS to an external file?
Thanks!June 10, 2021 at 9:24 am #1817755TomLead DeveloperLead Developer
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 🙂June 10, 2021 at 5:51 pm #1818052Rekindle
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?
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.June 11, 2021 at 9:14 am #1818924TomLead DeveloperLead 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?June 11, 2021 at 11:07 pm #1819383Rekindle
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.
- You must be logged in to reply to this topic.