
-
AuthorPosts
-
May 8, 2025 at 10:13 am #1483841
Hallo,
ich arbeite aktuell an einer WordPress-Seite, bei der über ein eigenes Frontend-Formular (nicht das WP-Backend) neue Beiträge eines Custom Post Types (“anzeige”) erstellt werden. Dabei werden verschiedene ACF-Felder ausgefüllt (Titel, Text, Ort etc.).
Ich habe auf eurer Doku-Seite
gelesen, wie man gespeicherte Custom Layouts (Templates) im ALB verwendet. Dort beschreibt ihr, dass man im Backend manuell ein gespeichertes Layout (z. B. „Anzeigen-Ansicht“) über das Dropdown auswählt – das funktioniert bei mir auch.
Mein Ziel ist jedoch, dass dieses gespeicherte Layout automatisch beim Erstellen des Beitrags gesetzt wird, damit ich nicht jedes Mal manuell im Backend eingreifen muss. Denn die Nutzer selbst haben keinen Backend-Zugang – alles läuft im Frontend.
Ich habe bereits beim Speichern folgende Felder gesetzt:
update_post_meta($post_id, '_avia_custom_template', 305); // ID des gespeicherten Templates update_post_meta($post_id, '_aviaLayoutBuilder_active', 'active'); wp_update_post([ 'ID' => $post_id, 'post_content' => '' ]);
Aber leider wird das gespeicherte ALB-Template im Frontend nicht angewendet. Es sieht so aus, als ob Enfold das Template ignoriert, solange man es nicht einmal manuell im Backend aufruft und speichert.
Gibt es eine Möglichkeit, dies automatisiert zu lösen? Also:
Ein gespeichertes ALB-Template automatisch einem Beitrag zuweisen
Und dass dieses Template dann auch im Frontend korrekt angezeigt wird, ohne manuellen Zwischenschritt im Backend
Ich wäre sehr dankbar über einen Hinweis oder Workaround!
Viele Grüße,
SvenMay 9, 2025 at 5:59 am #1483895Hey Launebaer1981,
Thank you for the inquiry.
The following thread should help: https://kriesi.at/support/topic/importing-lots-of-data-to-scf-custom-posts-all-having-same-template/#post-1473810
You may need to update the custom layout ID in _aviaLayoutBuilderCleanData and make sure the post type slug is correct. Also, remove this line to prevent the header from being set to transparent.
update_post_meta($post_id, 'header_transparency', 'header_transparent header_hidden');
Best regards,
IsmaelMay 9, 2025 at 9:13 am #1483910Thank you very much for your reply!
Unfortunately, this doesn’t solve the issue I’m facing.I have already seen the documentation at https://kriesi.at/documentation/enfold/custom-layout-and-dynamic-content/, but it requires selecting the custom layout manually in the Advanced Layout Builder (ALB) for each post.
What I’m looking for is a way to apply a saved custom layout automatically to newly created posts in a custom post type – in my case, “anzeige”.
These posts are not created in the backend but via a frontend form that fills ACF fields. So I would like the layout to be applied automatically without manual selection in the backend.Is there a way to assign a specific ALB layout automatically to posts, either via code or some internal Enfold function?
Thank you again for your help!
-
AuthorPosts
- You must be logged in to reply to this topic.