Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1299327

    Hi there,

    I’ve coded an import for a custom post type where you can upload a JSON file, and it generates the post based on the JSON.
    Now we have got two problems, but they may be connected to each other.

    The layout builder can’t be set as default for the custom post types – is there a better way than updating post meta and setting the _aviaLayoutBuilder_active-Meta to active? That’s my solution so far.

    Another problem is that as you can see on the link below, there is some space above the heading.
    The space disappears after saving the page again from the backend.

    I tried to add postmeta here again, but I’ve noticed that if I’m trying to add the meta _av_alb_posts_elements_state with the value “a:0:{}”, there will be something else saved in the database (Something like ‘ s:6:”a:0:{}” ‘).
    If I remove the “s:6” it works as expected.

    Why is this the case?

    #1299638

    Hey emilconsor,

    Thank you for the inquiry.

    Why do you have to manually add the a:():{}? s6 refers to the number of characters inside the string entry. Please note that the _av_alb_posts_elements_state should contain names of the elements that actually exist in the page.

    Example:

    a:5:{s:10:"av_heading";b:1;s:16:"av_image_hotspot";b:1;s:11:"av_one_half";b:1;s:12:"av_textblock";b:1;s:13:"av_image_spot";b:1;}
    

    This tells us that there is at least one special heading element, a hotpot, a 1/2 column and a text block in a page.

    Best regards,
    Ismael

    #1300883

    HI Ismael,

    I need to add the a:():{} because of the broken layout after importing the json-data.

    If I just activate the editor from the database, there is still the space above and the HTML-construct is wrong.
    After I’ve added the a:():{} manually to the database, the construct fixes himself (just like after saving in the backend).

    I need it to be automated since it is an import, that is why I add the metafields programmatically into the database – and that’s where the “s:6” appears. After deleting the s:6 from the database, the construct is fixed.
    Why does it add the s:6 even though I’m not inserting that?

    Regards,
    Fabian

    #1301160

    Hi,

    Have you tried including the post meta _av_alb_posts_elements_state in the import process that you created? It should be as simple as using the add_post_meta or the update_post_meta function.

    // https://developer.wordpress.org/reference/functions/add_post_meta/

    You can also create a plugin that builds the elements state or create _av_alb_posts_elements_state post meta info after the import.

    Related thread: https://kriesi.at/support/topic/adding-pages-using-the-wordpress-rest-api/#post-1032812

    Best regards,
    Ismael

    #1301342

    Hi,

    that worked like a charm! Thanks a lot!

    #1301346

    Hi,

    Glad Ismael could help! :)

    For your information, you can take a look at Enfold documentation here – https://kriesi.at/documentation/enfold/

    If you have any other questions or issues, feel free to start a new thread under Enfold sub forum and we will gladly try to help you :)

    Enjoy the rest of your day!

    Best regards,
    Yigit

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Layout Builder as default for custom types’ is closed to new replies.