Skip Navigation

[Résolu] Problem with feature image in Ads not copying to translated version

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

Problem:
How to duplicate the post in ALL configured WPML languages when post is created using CRED form.

Solution:
You can use CRED hook cred_save_data to duplicate the post in all language configured using WPML.

You can use WPML standard action "wpml_make_post_duplicates":

do_action( 'wpml_make_post_duplicates', $post_id );  

You can find proposed solution, in this case, with the following reply:
=> https://toolset.com/documentation/user-guides/using-toolset-with-beaver-builder/best-practices-creating-templates-beaver-builder/

Relevant Documentation:
https://wpml.org/wpml-hook/wpml_make_post_duplicates/

This support ticket is created Il y a 6 années et 9 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

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

Dernière mise à jour par PaulS4783 Il y a 6 années et 8 mois.

Assisté par: Minesh.

Auteur
Publications
#622585

I set the media translation within WPML as suggested.
https://toolset.com/forums/topic/free-ad-feature-image-doesnt-appear-on-translated-version/
It successfully copied the feature image to translations on EXISTING content.

However, when I tested again by adding a new FREE listing, it didn't copy the feature image.
lien caché
lien caché

Please advise what I should do.

#622943

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - I installed the classified's site and I'm able to reproduce this issue, I've report this issue for more information if this is expected behavior or bug.

I'll get in touch with you as soon as I know more.

#623230

Any update on this issue, yet?

#623276

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Well - there is no solution available for now but I've reported to next level support and they are investigating it. Please hold on for further updates.

#623303

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Well - to set featured image on translation you need to add following custom code to your current theme's functions.php file:

Could you please try to add following code and check if that help you to fix the issue.

add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data)
{
// if a specific form
if ($form_data['id']==99999)
{

// add it to saved post meta
$translated_id = apply_filters( 'wpml_object_id', $post_id, 'listing', true, 'es' );
$post_thumbnail_id = get_post_thumbnail_id( $post_id );
set_post_thumbnail( $translated_id, $post_thumbnail_id );

}
}

Where:
- Replace 99999 with your original CRED form Id.

#623525

Tried as you suggested.
But this didn't work.

add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data)
{
  // if a specific form
  if ($form_data['id']==6350)
  {
  // add it to saved post meta
  $translated_id = apply_filters( 'wpml_object_id', $post_id, 'listing', true, 'es' );
  $post_thumbnail_id = get_post_thumbnail_id( $post_id );
  set_post_thumbnail( $translated_id, $post_thumbnail_id );
 
  }
}
#623544

There are ALSO two different but perhaps related problem.

1. When I try to post a PREMIUM AD using may PayPal Sandbox account, the order is held as pending.
I need to go into the WooCommerce Orders list and update the order status from ON HOLD to COMPLETE.
How can I get WooCommerce to automatically save the order as COMPLETE? (Virtual/Downloadable are both checked)?

2. However, once I change the order status to COMPLETE, the site goes ahead and creates the translated version:
a) It DOES copy the feature image BUT
b) It DOESNT use the custom post template. It uses the standard "post" template.
e.g.
lien caché

Please advise.

#623557

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Well - we will deal here with the featured image issue and please kindly open a new ticket with your each new questions. That will help other users searching on the forum. Thank you for understanding.

Regarding featured image issue: I need access details in order to check whats going wrong there.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#624254

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Yes - I need FTP access details as its needed to edit your functions.php file. Could you please share it.

I have set the next reply to private which means only you and I have access to it.

#624610

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Ok - finally. I've added following code to your current theme's functions.php file:

add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data){
  // if a specific form
  if ($form_data['id']==6350){
	  
	   do_action( 'wpml_make_post_duplicates', $post_id );            
  }
}

This will make entire post duplicate to your another language so you will have to adjust your content accordingly.

#624803

OK. Thank you. That appears to work now.