Saturday 4 February 2023

Create Elementor duplicate pages with different name .

  $csvdata = csv_to_array('../city.csv');

foreach($csvdata as $key=>$csvrow){

if($key==1){

$postidd = get_post(13); 

$frontend = new \Elementor\Frontend();

$pagecontentorg = $frontend->get_builder_content_for_display( 13, $with_css = true );

//apply_filters('the_content', $postidd->post_content); 

$pagecontent = str_replace("problèmes",$csvrow['city'],$pagecontentorg); 

  $post_details = array(

  'post_title'    => 'testing page 5',

  'post_content'  =>$pagecontent,

  'post_status'   => 'publish',

  'post_author'   => 1,

  'post_type' => 'page',

  'page_template'  => 'elementor_header_footer'

   );

   wp_insert_post( $post_details );

/*echo '<pre>';

print_r($csvrow['city']);

echo '</pre>';*/

}

No comments:

Post a Comment