Review Block – Not outputting correctly on frontend
-
Hi guys,
I just implemented my first Review block in a post I’m drafting at the moment.
I added a list of features, set the star colour (it would be nice to have a config option for this, so I don’t have to set the same colour scheme every single time I use the block – but that’s a different topic!!!) and the button colour and entered my Summary/Author/Title.However, when I preview the post – the output on the frontend is… well… take a look for your self:
Editor: https://snipboard.io/nlvmGP.jpg
Frontend: https://snipboard.io/d7hfje.jpgThere are no errors in the browser console to indicate anything went wrong. The button has no colour (even though I don’t want the CTA button there at all – I didn’t populate the link so expected it not to show on the frontend).
What can I do to resolve this?
UB: v2.1.3
WP: v5.2.3
PHP: v7.3
-
Hi @willstockstech ,
Sorry to hear about that. Unfortunately, we couldn’t replicate the issue on our end. Can you trying saving the post as draft first and then preview it?
We will keep trying to replicate it on our end.
About the CTA button, we will most probably add an option to turn it off/on.
Regards.
I did try saving as draft then previewing – it was still the same.
I have just installed “Public Post Preview” so I can share the post with you. Please see the link below.
One thing I forgot to note! I’m using the Gutenberg plugin (v6.4) as well! There’s some strange behaviour with the input fields (most of the time I can’t focus them!) for the Review block and it looks like deprecated input methods might be being used?
I have now disabled the Gutenberg plugin completely, to avoid the input field issues (wp.editor -> wp.blockEditor) and I’m still seeing the backend and frontend not matching up.
Backend: https://snipboard.io/ZqSTnw.jpg
Frontend: https://willstocks.co.uk/?p=2943&preview=1&_ppp=bb1b3a7b15 & https://snipboard.io/7ROMkU.jpgGutenberg Plugin errors:
wp.data.select( 'core/editor' ).getBlock is deprecated. Please use wp.data.select( 'core/block-editor' ).getBlock instead. wp.editor.RichText is deprecated. Please use wp.blockEditor.RichText instead. wp.editor.withColors is deprecated. Please use wp.blockEditor.withColors instead.I think I’ve found something!!!
[Mon Sep 09 13:10:19.323189 2019] [proxy_fcgi:error] [pid 6920:tid 140337376880384] [client 127.0.0.1] AH01071: Got error 'PHP message: PHP Warning: array_map(): Expected parameter 2 to be an array, null given in /mysite/wp-content/plugins/ultimate-blocks/src/blocks/review/block.php on line 30 PHP message: PHP Warning: array_sum() expects parameter 1 to be array, null given in /mysite/wp-content/plugins/ultimate-blocks/src/blocks/review/block.php on line 32 PHP message: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /mysite/wp-content/plugins/ultimate-blocks/src/blocks/review/block.php on line 32 PHP message: PHP Warning: Division by zero in /mysite/wp-content/plugins/ultimate-blocks/src/blocks/review/block.php on line 32 PHP message: PHP Warning: Invalid argument supplied for foreach() in /mysite/wp-content/plugins/ultimate-blocks/src/blocks/review/block.php on line 36', referer: https://willstocks.co.uk/wp-admin/post.php?post=2943&action=editThis was in my Apache error log!
Also:
About the CTA button, we will most probably add an option to turn it off/on.
Thank you! I can confirm that it is working perfectly and looks much better 🙂
Just need the stars now 😀
Thank you so much for the error log. That will definitely help us to work on the issue.
About the stars, you mean settings to configure a color scheme?
Thanks @imtiazrayhan 😀
Re: Color scheme – yes, it would be nice for me to set a global default color if possible, that matches my brand colors? That way, only “edge cases” I have to select other colors and instead the stars match my color scheme by “default” if that makes sense?
I know I have the option per post, but if I posted 10+ reviews per day, I would definitely forget at least once :’)
Hey @imtiazrayhan
Do you need any other logs/examples from me for this one?
I’ve checked the obvious things that come to mind and that Apache log is the only one I can find so far!
Thanks,
WillHi @willstockstech ,
So we have been working on it and changed some things.
Please update the plugin to the latest version. Let us know if the new approach works on your end.
Regards.
I have just updated and I am now seeing the following error being logged:
[Wed Oct 02 21:18:09.551994 2019] [proxy_fcgi:error] [pid 22552:tid 140337559992064] [client 127.0.0.1:55310] AH01071: Got error ' PHP message: PHP Warning: array_map(): Expected parameter 2 to be an array, null given in /mysite/wp-content/plugins/ultimate-blocks/src/blocks/review/block.php on line 34 PHP message: PHP Warning: array_sum() expects parameter 1 to be array, null given in /mysite/wp-content/plugins/ultimate-blocks/src/blocks/review/block.php on line 36 PHP message: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /mysite/wp-content/plugins/ultimate-blocks/src/blocks/review/block.php on line 36 PHP message: PHP Warning: Division by zero in /mysite/wp-content/plugins/ultimate-blocks/src/blocks/review/block.php on line 36 PHP message: PHP Warning: Invalid argument supplied for foreach() in /mysite/wp-content/plugins/ultimate-blocks/src/blocks/review/block.php on line 40', referer: https://willstocks.co.uk/?p=2943&preview=trueLet me know if you need any further info?
Hi @imtiazrayhan
Is there any progress with regards to the above?
Cheers,
WillHi @willstockstech ,
Sorry for the late reply.
We thought it was an issue with JSON strings, so we converted the attributes to PHP arrays. We were hoping that would fix it.
Looks like practically nothing changed with the error message, as the same part that triggered the earlier message triggered it again.
At this point, we are not exactly sure what’s causing this. I am sorry about that.
If possible can you please give the block a try in a different site or install?
Thank you for being so helpful with this.
Regards.
Hi @imtiazrayhan ,
Thanks for getting back to me 🙂
I’ve cleared all opcode caching etc. and I’m now not seeing PHP errors being logged at the moment (some good news I suppose!), however I’m still not seeing the output on the frontend correctly. I also uninstalled and reinstalled the plugin for good measure.
I will get another site set up to do some further testing, but really basic troubleshooting and taking the output from the frontend:
print_r($attributes):
Array ( [blockID] => [authorName] => [itemName] => [items] => [{"label": "", "value": 0}] [starCount] => 5 [summaryTitle] => Summary [summaryDescription] => [callToActionText] => [callToActionURL] => [callToActionBackColor] => #f63d3d [callToActionForeColor] => #ffffff [inactiveStarColor] => #888888 [activeStarColor] => #eeee00 [selectedStarColor] => #ffff00 [titleAlign] => left [authorAlign] => left [enableCTA] => 1 [ctaNoFollow] => 1 [ctaOpenInNewTab] => 1 )print_r(extract($attributes)):
19print_r($parsedItems):
Array ( [0] => Array ( [label] => [value] => 0 ) )print_r($blockID):
print_r($extractedValues):
Array ( [0] => 0 )My block was set up as follows:
Title: Test Author: Will Item 1: Test 1 Item 1 Star: 4 Item 2: Test 2 Item 2 Star: 3 Summary Title: Summary Summary Content: This is a test No call to action definedOK… I think I might have found an incompatibility with a plugin I use: Remove Orphan Shortcodes.
There’s nothing obvious, but I’ve been going through all of my plugins and de-activating them one-by-one and retesting and this one seems to result in the frontend displaying!!!
Have you ever heard of this before?
I have just logged this with Remove Orphan Shortcodes: https://wordpress.org/support/topic/breaks-ultimate-blocks-plugin-frontend/
Hi Will,
So I installed Remove Orphan Shortcodes and same thing happened on my end. Features, title, summary disappeared.
I think the slider issue could also be due to Remove Orphan Shortcodes plugin.
We never came across this issue before. I will see if we can figure something out.
Regards.
The topic ‘Review Block – Not outputting correctly on frontend’ is closed to new replies.