$instance
$instance : mixed
Public static variable to hold the single instance of MainWP_Child_Posts.
Class MainWP_Child_Posts
Handle all post & post plus actions.
get_instance() : \MainWP\Child\MainWP_Child_Posts|null
Create a public static instance of MainWP_Child_Posts.
get_recent_posts(array $pAllowedStatuses, integer $pCount, string $type = 'post', null $extra = null) : array
Get recent posts.
array | $pAllowedStatuses | Array of allowed post statuses. |
integer | $pCount | Number of posts. |
string | $type | Post type. |
null | $extra | Extra tokens. |
$allPost Return array of recent posts.
get_recent_posts_int(string $status, integer $pCount, string $type, array $allPosts, null $extra = null)
Initiate get recent posts.
string | $status | Post status. |
integer | $pCount | Number of posts. |
string | $type | Post type. |
array | $allPosts | All posts array. |
null | $extra | Extra tokens. |
replace_advanced_image(array $content, array $upload_dir, boolean $withslashes = false) : mixed
Method replace_advanced_image()
Handle upload advanced image.
array | $content | post content data. |
array | $upload_dir | upload directory info. |
boolean | $withslashes | to use preg pattern with slashes. |
array of result.
create_post(array $new_post, array $post_custom, string $post_category, string $post_featured_image, string $upload_dir, string $post_tags, array $others = array()) : array|array<mixed,string>
Create new post.
array | $new_post | Post data array. |
array | $post_custom | Post custom meta data. |
string | $post_category | Post categories. |
string | $post_featured_image | Post featured image. |
string | $upload_dir | Upload directory. |
string | $post_tags | Post tags. |
array | $others | Other data. |
$ret Return success array, permalink & Post ID.
set_post_custom_data(array $new_post, array $post_custom, string $post_tags, string $edit_post_id, boolean $is_post_plus)
Set custom post data.
array | $new_post | Post data array. |
array | $post_custom | Post custom meta data. |
string | $post_tags | Post tags. |
string | $edit_post_id | Edit Post ID. |
boolean | $is_post_plus | TRUE|FALSE, Whether or not this came from MainWP Post Plus Extension. |
update_post_data(string $new_post_id, array $post_custom, string $post_category, string $post_featured_image, boolean $check_image_existed, boolean $is_post_plus, array $others)
Update post data.
string | $new_post_id | New post ID. |
array | $post_custom | Post custom meta data. |
string | $post_category | Post categories. |
string | $post_featured_image | Post featured image. |
boolean | $check_image_existed | TRUE|FALSE, Whether or not featured image already exists. |
boolean | $is_post_plus | TRUE|FALSE, Whether or not this came from MainWP Post Plus Extension. |
array | $others | Others data. |
update_found_images(array $new_post, string $upload_dir, boolean $check_image_existed)
Search for all the images added to the new post.
array | $new_post | Post data array. |
string | $upload_dir | Upload directory. |
boolean | $check_image_existed | TRUE|FALSE, Whether or not featured image already exists. |
create_set_categories(string $new_post_id, string $post_category, boolean $post_to_only)
Create new and set categories.
string | $new_post_id | New post ID. |
string | $post_category | Post category. |
boolean | $post_to_only | TRUE|FALSE, Whether or not to post only to this category. |
set_custom_post_fields(string $new_post_id, array $post_custom, boolean $seo_ext_activated, boolean $post_to_only)
Set custom post fields.
string | $new_post_id | New post ID. |
array | $post_custom | Post custom meta data. |
boolean | $seo_ext_activated | TRUE|FALSE, Whether or not Yoast SEO is activateed or not. |
boolean | $post_to_only | TRUE|FALSE, Whether or not to post only to this category. |
create_featured_image(string $new_post_id, string $post_featured_image, boolean $check_image_existed, array $others)
Create featured image.
string | $new_post_id | New post ID. |
string | $post_featured_image | Post featured image. |
boolean | $check_image_existed | TRUE|FALSE, Whether or not featured image already exists. |
array | $others | Post custom others meta data. |