class-ld-import-topic.php
1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* LearnDash Import Topic CPT
*
* This file contains functions to handle import of the LearnDash Topic
*
* @package LearnDash\Import
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ( ! class_exists( 'LearnDash_Import_Topic' ) ) && ( class_exists( 'LearnDash_Import_Post' ) ) ) {
/**
* Class to import topics
*/
class LearnDash_Import_Topic extends LearnDash_Import_Post {
/**
* Version
*
* @var string Version.
*/
private $version = '1.0';
/**
* Destination Post Type
*
* @var string $dest_post_type
*/
protected $dest_post_type = 'sfwd-topic';
/**
* Source Post Type
*
* @var string $source_post_type
*/
protected $source_post_type = 'sfwd-topic';
/**
* Destination Taxonomy
*
* @var string $dest_taxonomy
*/
protected $dest_taxonomy = 'ld_topic_tag';
/**
* Duplicate post
*
* @param integer $source_post_id Post ID to copy.
* @param boolean $force_copy Whether to force the copy. Default false.
*
* @return WP_Post
*/
public function duplicate_post( $source_post_id = 0, $force_copy = false ) {
$new_post = parent::duplicate_post( $source_post_id, $force_copy );
return $new_post;
}
/**
* Duplicate Post's taxonomies
*
* @param WP_Term $source_term WP_Term to duplicate.
* @param boolean $create_parents Whether to create parent taxonomies. Default false.
*
* @return WP_Term
*/
public function duplicate_post_tax_term( $source_term, $create_parents = false ) {
$new_term = parent::duplicate_post( $source_term, $create_parents );
return $new_term;
}
// End of functions.
}
}