I had a similar problem like the thread Custom inline CSS stripped for not logged-in users? and could reproduce the cause for my problem.
Inside a text editor field I put a style instruction for a background image.
When being logged in everything was fine. Being logged out the background image wouldn’t show.
I disabled all plugins but the Page Builder Plugin and then it worked!
By enabling the plugins one after another I found the reason for the error.
It’s the SiteOrigin Widgets Bundle!
Unfortunately the Page Builder does not work for editing without the Widgets Bundle.
However the created pages are shown properly, even if the Widgets Bundle is disabled.
For reproducing the error and to find a solution here are the versions I am using:
– WordPress 4.4
– SiteOrigin Page Builder 2.2.2
– SiteOrigin Widgets Bundle 1.5.4
The CSS instruction I use in a text editor widget is:
Hi Horhau
Thanks for posting your question.
Was the style block just a test? Ideally, a rule like the one you’ve posted above should be placed in a Custom CSS plugin like SiteOrigin CSS. The body rule should be inserted at Appearance > Custom CSS.
No it wasn’t. I tried several approaches and only one worked – at least when being logged in.
As far as I understand the CSS plugin, it works for the whole web site and therefore for all pages. However I need the background-image on some pages only. So the CSS plugin does not do the job for my requirements.
Putting the CSS instructions into the CSS styles field of a text editor widget on a page does the job only for that widget and not for the whole page.
Writing the CSS instructions into a SiteOrigin text editor widget does the job. However only when being logged in.
See below the three screenshots:
1. The design of the page by PageBuilder. The CSS instruction is inserted into the editor widget in the top row.
2. Page as desired – however only when being logged in.
3. Page when being logged out.
What do you recommend?
Horst
Please, send us the link to the page you’d like to apply the image on and we’ll assist with a CSS rule that can be inserted at Appearance > Custom CSS. WordPress adds a unique body class to every post and page so it’s relatively easy to target page/post specific elements.
This is a private message.
Thanks. If you inspect the source code on this page you’ll see the following body class:
page-id-997
You can therefore say:
You can also get a page ID by going to Pages in WordPress and editing a page. Check the URL, there will be a single number visible, that’s the page ID.
Perfect, that works :-)
A last question: If I want to apply the same background image to several pages, how do I need to address those pages? Must I repeat the CSS instruction for every page or can I use somehow a list of the pages for which to apply the background image?
Thanks, Horst.
Super :)
To do a batch you can say:
Replacing xxx with the required page ID’s.
Thanks for your help.
Everything works fine now.
Horst
That’s great news :) Glad we could assist.