Sauter la navigation

[Résolu] Sidebar showing below main content

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: When a post is created with Forms, the appropriate Divi template isn't applied correctly and the sidebar appears under the post.

Solution: Use a custom code snippet to apply the appropriate Divi template:

add_action('cred_save_data', 'save_sidebar_layout_action',10,2);
function save_sidebar_layout_action($post_id, $form_data)
{
    // if a specific form
    if ($form_data['id']==1243)
    {
         
          // add it to saved post meta
          update_post_meta($post_id, '_et_pb_page_layout', 'et_right_sidebar');
          
    }
}

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

This support ticket is created Il y a 5 années et 2 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Ce sujet contient 4 réponses, a 2 voix.

Dernière mise à jour par Daniel Stadeli Il y a 5 années et 2 mois.

Assisté par: Christian Cox.

Auteur
Publications
#1375723
Sidebar shown below content - Upload Form settings.jpg
Sidebar shown below content - ERROR.jpg
Sidebar shown below content - CORRECT.jpg

When I enter a post through the backend, the sidebar is positioned correctly.
When I enter a post through the front end form, the sidebar is positions wrongly (below the post content).

I am trying to: Enter a new post through the front end form "post-bibleverse-combine-form" (lien caché). The post is created correctly, but when I view the post, the sidebar is shown at the bottom of the main content instead of the side where it should be.

I expected to see: the sidebar on the right side of the content, as seen here: lien caché (this is an older post it works)

Instead, I got: sidebar at the bottom of the content. lien caché

Both posts apparently use the same template "Template für Materialien Details" (lien caché)

I added the form settings of the upload form, can you pls. have a look what is wrong?

#1375823

Hi, it appears that the Divi page layout setting isn't applied properly to new posts created with Forms. If you save the new post in wp-admin, it will begin showing the sidebar as expected. I have added a small piece of custom code that should fix this for you, and apply the sidebar to all posts created by this Form. Here is the code:

add_action('cred_save_data', 'save_sidebar_layout_action',10,2);
function save_sidebar_layout_action($post_id, $form_data)
{
    // if a specific form
    if ($form_data['id']==1243)
    {
        
          // add it to saved post meta
          update_post_meta($post_id, '_et_pb_page_layout', 'et_right_sidebar');
         
    }
}

I placed this code in a new code snippet in Toolset > Settings > Custom Code, and activated it. I created this test post:
lien caché

On the front-end I can see that the sidebar is applied correctly. Can you confirm?

#1375843
Post tags on front end form are not being shown. 007.jpg

Thanks Christian, now it works!

But I have another issue: On the upload form I have a field to enter tags, when I start typing I think there are suggestions hidden behind the blue Add Button (Hinzufügen). Is there a way to show these terms?
Also, why are the terms I entered not being shown under the red most used terms? How many times does a term have to be used to be seen here?

Les nouveaux fils créés par Christian Cox et associés à celui-ci sont repris ci-dessous :

https://toolset.com/fr/forums/topic/most-used-terms-and-term-suggestions-in-forms/

#1376323

I have split your new questions into a separate ticket. Let's follow up there.

#1376407

My issue is resolved now. Thank you Christian!