layers-wp / layerswp

Layers WordPress theme by Obox
http://www.layerswp.com
Other
23 stars 10 forks source link

Pages running Layers theme not rendering any content #450

Closed CristianHG2 closed 10 months ago

CristianHG2 commented 10 months ago

Hello,

This repository hasn't seen activity in a few years, but I thought I should shoot my shot.

We have a Layers website with thousands of pages running on it. Due to the widget-driven approach and how heavy it can be on the database, the website has been progressively slowing down more and more; however, as of recent weeks, we've noticed that Layers pages no longer render at all.

Since Layers renders everything based on widgets, I have had a very tough time navigating the source code to figure out what's wrong. I am unsure when the widgets are registered or how their content even renders, but this is probably just my unfamiliarity with the widgets system.

Essentially, the whole theme renders EXCEPT the main content itself. Navigation, header, and footers are intact. We've begun moving towards SiteOrigin PageBuilder, and those pages render fine, but any on the Layers template (builder.php) do not render any content.

Any assistance would be greatly appreciated.

CristianHG2 commented 10 months ago

We were able to restore the content. Naturally, this issue could have a million origins; in our case, it had to do with how Layers renders things through sidebar widgets rather than actual content or more modern "blocks."

Our fix consisted of using an older database version to get the content of the sidebars_widgets option on the wp_options table. The structure that Layers impose on this option (_found in the option_value column)_ is a serialized string that, when unserialized, looks like this:

[
    "obox-layers-builder-[page ID]" => [
        "layers-widgets-widget-123"
    ],

    "obox-layers-builder-[page ID2]" => [
        "layers-widgets-widget-456"
    ]
]

The plugin moves all of these individual nested arrays into a single wp_inactive_widgets, which makes Layers unable to identify which widgets get rendered where:

[
    "wp_inactive_widgets" => [
        "layers-widgets-widget-123",
        "layers-widgets-widget-456",
    ]
]

We could use our old database backup to grab the old structure and replace the new value in the current database. We did not lose data since we no longer build new pages with Layers. I recommend that you switch to Elementor, which provides a migration utility from LayersWP, to stay supported.

marcperel commented 10 months ago

I'm glad you found a way here @CristianHG2 I'm amazed you had thousands of pages.

The builder was built on the old customizer widget structure which didn't really support more than 50 pages usually (the DOM would overload and freeze).

It's best to move over to a new builder, which I see that you are, nice work.