evergf88
Forum Replies Created
-
Forum: Plugins
In reply to: [All Bootstrap Blocks] Feature request: show div ids in the editorIt’s exactly what i was looking for.
Thanks!
@areoimiles thanks for all your help, but I must remind you that the problem persists in the latest versions (1.3.7 and 1.3.8) and that the statement that causes me the problem remains unchanged in the AREOI code.
Currently, I apply this patch in class.areoi.styles.php, lines 185, 186 to make the plugin working ok in my sites:
$page = get_the_ID(); $standard_blocks = ( $page === false ? array() : parse_blocks( get_the_content() ) );
Regards best
Hi Miles.
Unfortunately, both the $page and $pages variables I receive with null value and the styles are not applied.
Possible solution?
?Maybe replacing the use of the global $page with…
$page = get_the_ID();
And the conditional with…
$standard_blocks = ( $page === false ? array() : parse_blocks( get_the_content() ) );
In my reduced understanding of the WP Core, the $page variable is equivalent with the return value of “get_the_ID()” with the difference that when is not value, it returns “false” instead “null”.
I tried this code and it works ok. I hope it can help
Regards
Thanks for all Miles. Regards
Miles, thanks for your help to reach this point.
The key of my problem is there, in class.areoi.styles.php file. This class, in order to make the final recap to add the required inline styles, in the add_block_styles method merges 4 arrays previosly processed and then merges then (line 228):
$blocks = array_merge( $standard_blocks, $page_reuseable_blocks, $reuseable_blocks, $template_blocks, $widget_blocks );
I dump the values of each one and only $widget_blocks have an array with values inside. The others are all empty. That is the problem.
$template_blocks doesn’t apply to my theme because there is not a modern block theme (like the anothers themes tried for myself to report this issue, e.g. twenty-twentythree).
I think that the necessary variable to generate the inline styles is $standard_blocks. The key to generate this var are in the lines 179-180:
global $page; $standard_blocks = ( $page === null ? array() : parse_blocks( get_the_content() ) );
When i dump the value of $standard_blocks, it’s a empty array. That’s mean that the $page global variable are null (checked by var_dump()). If i replace the conditional with:
$standard_blocks = parse_blocks( get_the_content() );
Ualá, the styles are loaded correctly.
Then… Why the $page variable returns null here? Is only a problem of my theme or happens to another classic themes?
Regards
Effectively, $blocks returns a empty array: Array()
And $styles returns a empty string: “”
Somewhere, fails generating this vars
Ok, i send you the code of the index of my web and the functions.php where i can’t find anything weird.
And i try to comment the most of lines in functions.php but it keeps failing.
You can view the actual result in the actual web url.
Another weird thing is that actually another values like ‘row-cols’ or aligns works well. The only fail point are the margins and paddins
Thanks for your help
https://drive.google.com/file/d/1m6YKim9WKTtr7pp_fKAjX6yaYjd1tK1i/view?usp=drive_link
- This reply was modified 1 year, 10 months ago by evergf88. Reason: forgot include the file