Page 1 of 1
custom style for layer
Posted: Sat Aug 19, 2023 3:58 pm
by jimakos
Hello,
In a Layer, after right-clicking and selecting the HTML object, I enter
in the custom style field. This custom style is the return from a PHP function - anim().
The page is set to have PHP file extension in page properties.
The PHP file containing the 'anim()' function is included within an HTML script between <head></head> tags.
Something is going wrong, as no custom style is being applied, and even the content
(<?php echo anim(); ?>) I'm placing in the custom style field is not present in the PHP file I'm publishing.
Thank you
Re: custom style for layer
Posted: Sat Aug 19, 2023 4:08 pm
by Pablo
The custom style section is for adding (inline) style attributes, not for adding PHP code.
Re: custom style for layer
Posted: Sat Aug 19, 2023 4:41 pm
by jimakos
In WYSIWYG Web Builder 17, it works correctly.

Re: custom style for layer
Posted: Sat Aug 19, 2023 5:06 pm
by Pablo
Maybe you have used different HTML output settings?
For example, if you enable 'use external css' then the code may be moved to the external CSS..
Do you have a DEMO project?
viewtopic.php?f=10&t=82134
Re: custom style for layer
Posted: Sat Aug 19, 2023 5:59 pm
by jimakos
Ηι,
I cloned the page within the same project, and the issue persisted in the published version. The page had a responsive layout, which I deleted, and everything worked fine during publishing. Something seems to be happening when a responsive layout is present.
Thank you
Re: custom style for layer
Posted: Sun Aug 20, 2023 6:56 am
by Pablo
Do you have a DEMO project?
viewtopic.php?f=10&t=82134
Re: custom style for layer
Posted: Sun Aug 20, 2023 8:13 am
by jimakos
demo link:
http://213.136.75.102/customstyledemo.wbs
The problem is as follows. When we don't have a responsive layout, after clicking "Publish," the custom style appears directly in the PHP or HTML file in the same line as the <div> tag of the layer. Therefore, if the custom style is PHP code, it will execute normally. However, if we have a responsive layout, the custom style, along with the publish action, goes to the corresponding CSS file. That's why, if it's PHP code, it can't execute. It's a simple demo project. We open a page, add a layer, right-click, select custom style, and add something like background-color: #EBEBEB;. Then we right-click and select "page HTML," and we will see <div id="Layer1" style="position:absolute;text-align:left;width:151px;height:75px; background-color: #EBEBEB; background-color: #EBEBEB;">. If we set a breakpoint, e.g., 320px, and click on "page HTML," we will only see <div id="Layer1">; the style is in the page.css file. So, most likely, nothing can be done about this.
Thank you
Re: custom style for layer
Posted: Sun Aug 20, 2023 9:19 am
by Pablo
This is normal behavior for responsive layout, because inline styles cannot be responsive.
There is a workaround but this may have other side effects, so use with care:
Tools -> Options -> HTML -> Keep inline style in Responsive Web Design.
Re: custom style for layer
Posted: Sun Aug 20, 2023 10:42 am
by jimakos
You have done a great job, thank you very much!