PluginProbe
Themify Builder / 7.7.0
Themify Builder v7.7.0
7.8.1 7.8.0 7.7.9 7.7.8 7.7.7 7.7.6 7.7.5 7.7.4 7.7.3 7.7.2 trunk 7.6.0 7.6.1 7.6.2 7.6.3 7.6.4 7.6.5 7.6.6 7.6.7 7.6.8 7.6.9 7.7.0 7.7.1
themify-builder / includes / plugin-compat / duplicateposts.php

duplicateposts.php in Themify Builder 7.7.0, at includes/plugin-compat/duplicateposts.php

37 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Builder Plugin Compatibility Code
4 *
5 * @package Themify_Builder
6 * @subpackage Themify_Builder/classes
7 */
8
9 class Themify_Builder_Plugin_Compat_DuplicatePosts {
10
11 static function init() {
12 add_filter( 'option_duplicate_post_blacklist', array( __CLASS__, 'dp_meta_backlist'), 10, 2 );
13 add_action('dp_duplicate_post', array( __CLASS__, 'dp_duplicate_builder_data'), 10, 2);
14 add_action('dp_duplicate_page', array( __CLASS__, 'dp_duplicate_builder_data'), 10, 2);
15 }
16
17 /**
18 * Backlist builder meta_key from duplicate post settings custom fields
19 */
20 public static function dp_meta_backlist(string $value,string $option ):string {
21 $list_arr = explode(',', $value );
22 $list_arr[] = '_themify_builder_settings_json';
23 return implode( ',', $list_arr );
24 }
25
26 /**
27 * Action to duplicate builder data.
28 *
29 * @access public
30 * @param int $new_id
31 * @param object $post
32 */
33 public static function dp_duplicate_builder_data( $new_id, $post ) {
34 $builder_data = ThemifyBuilder_Data_Manager::get_data( $post->ID ); // get builder data from original post
35 ThemifyBuilder_Data_Manager::save_data( $builder_data, $new_id ); // save the data for the new post
36 }
37 }