Home>Support>Render So Content from custom field

Render So Content from custom field

Hi,
I’m using this 3rd Party Plugin () which enables SO Builder as a ACF field.
Everything works fine, but (only) the headline widget does not render completely (only renders the wrapper).

I tested around and found, if I have the same content in a post as the content, it works fine.

So I would like to render the content from the custom field with the SO engine.

I figured something like this could work:

$mycustomcontent = SiteOrigin_Panels::renderer()->render( false, true, get_field('acf_page_builder_field',$postid) );

But this gives me nothing.

Here is what is in the database for the field “acf_page_builder_field”. It looks like it is not serialized. Can this be an issue.
It works for all other widgets, except the headline.

{"widgets":[{"title":"","text":"testtext","filter":"on","visual":"on","panels_info":{"class":"WP_Widget_Text","raw":true,"grid":0,"cell":0,"id":0,"widget_id":"f005cfbd-259a-49e5-b8dc-98301431f975","style":{"id":"","class":"","widget_css":"","mobile_css":"","margin":"","padding":"","mobile_padding":"","background":"","background_image_attachment":"0","background_image_attachment_fallback":"","background_display":"tile","border_color":"","font_color":"","link_color":""}}},{"headline":{"text":"testheadline","destination_url":"","tag":"h1","color":"","hover_color":"","font":"default","font_size":"","font_size_unit":"px","align":"center","line_height":"","line_height_unit":"px","margin":"","margin_unit":"px","so_field_container_state":"open"},"sub_headline":{"text":"","destination_url":"","tag":"h3","color":"","hover_color":"","font":"default","font_size":"","font_size_unit":"px","align":"center","line_height":"","line_height_unit":"px","margin":"","margin_unit":"px","so_field_container_state":"closed"},"divider":{"style":"solid","color":"#EEEEEE","thickness":"1","align":"center","width":"80","width_unit":"%","margin":"","margin_unit":"px","so_field_container_state":"closed"},"order":"headline,divider,sub_headline","fittext_compressor":"0.85","_sow_form_id":"9376360355fb3bfcc23ce1124410706","_sow_form_timestamp":"1605615578243","panels_info":{"class":"SiteOrigin_Widget_Headline_Widget","raw":true,"grid":0,"cell":0,"id":1,"widget_id":"3ba39ee6-d0f5-4feb-9a5c-cfeab4851ab8","style":{"id":"","class":"","widget_css":"","mobile_css":"","margin":"","padding":"","mobile_padding":"","background":"","background_image_attachment":"0","background_image_attachment_fallback":"","background_display":"tile","border_color":"","font_color":"","link_color":""}}}],"grids":[{"cells":1,"style":{}}],"grid_cells":[{"grid":0,"index":0,"weight":1,"style":{}}]}

Maybe someone can give me a hint in the right direction to render this the right way! :)

Thanks Sascha

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 17 days, 16 hours ago polimehr

    Hey, I dug deeper into this.
    I managed to get the general rendering done:

    	
    $sop_content = json_decode(get_field('acf_page_builder_field',$postid, false),true);
    $mainBeschreibung = SiteOrigin_Panels::renderer()->render( false, true, $sop_content );

    The issue might be because the plugin I use (forgot to link in the above post): https://wordpress.org/plugins/acf-page-builder-field/
    saves the widget configs as json and not serialized data?

    I’m puzzled why it works for all widgets except headline. Maybe the way it works with the template file in the headline directory?
    /widgets/headline/tpl/default.php

    Thanks for every 2 Cent you can spare ;)

  2. 17 days, 15 hours ago Alex S Hi, I Work Here

    Hi Sascha,

    The code you’ve provided looks fine to me. The render method $panels_data parameter should be non-serialized data so what you’re doing is correct.

    Can you please provide me with an export of your layout? This will allow me to run some tests using it. You can do this by opening your the page builder button and click the layout button in the Page Builder toolbar. Then click import/export and then click download. Please upload the export to a 3rd party file hosting site such as WeTransfer (no email is required).

    Kind regards,
    Alex

  3. 16 days, 22 hours ago polimehr

    Hi Aley,
    you looking into this is very much appreciated! :)

    https://we.tl/t-mHzz5ucUce

    Here is an example of the layout I have in the ACF page builder field. Everything looks great except the headline widget on the very top of the layout. The html at that instance is like this:

    <div class="container panel-row-style panel-row-style-for-2317-0"><div id="pgc-2317-0-0" class="panel-grid-cell"><div id="panel-2317-0-0-0" class="so-panel widget widget_sow-headline panel-first-child panel-last-child" data-index="0"><div class="panel-widget-style panel-widget-style-for-2317-0-0-0"><div class="so-widget-sow-headline so-widget-sow-headline-default-bb424dd754ae"><div class="sow-headline-container ">
    	</div></div></div></div></div></div>

    Which looks like it does not render the innerpart. :(

    Best regards Sascha

  4. 15 days, 22 hours ago Alex S Hi, I Work Here

    Hi Sascha,

    Thanks. I’ve had a look over the provided layout and I don’t see any issues with that should prevent it from rendering.
    Do any errors get logged when you attempt to render the layout?

    Kind regards,
    Alex

  5. 15 days, 20 hours ago polimehr

    I have an error in the php log. But this might be related to something else.

    2020/11/19 14:41:44 [error] 28121#28121: *205047 FastCGI sent in stderr: “PHP message: PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘create_post_type_html5’ not found or invalid function name in /var/www/web/wp-includes/class-wp-hook.php on line 287PHP message: PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘enable_threaded_comments’ not found or invalid function name in /var/www/web/wp-includes/class-wp-hook.php on line 289” while reading response header from upstream, client: 93.133.184.49, server: mydomain.de, request: “GET /folder/angebottest/?angebot=8047 HTTP/2.0”, upstream: “fastcgi://unix:/var/lib/php7.0-fpm/web849.sock:”, host: “www.mydomain.de”

  6. 14 days, 20 hours ago polimehr

    BTW, the page in question is here:
    https://www.meinfernsehen.de/m7-test/angebottest/?angebot=8047
    The missing headline is right below the top slider.

Please log in to post on our forums. Signing up is free.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More