wenpai.org/wp-content/plugins/advanced-query-loop/includes/Traits/Post_Parent.php
2024-12-09 23:55:39 +08:00

27 lines
483 B
PHP

<?php
/**
* Post Parent Processing
*/
namespace AdvancedQueryLoop\Traits;
/**
* Trait
*/
trait Post_Parent {
/**
* Main processing function.
*/
public function process_post_parent(): void {
$parent = $this->custom_params['post_parent'];
if ( $this->is_post_id( $parent ) ) {
$this->custom_args['post_parent'] = $parent;
} else {
// This is usually when this was set on a template.
global $post;
$this->custom_args['post_parent'] = $post->ID;
}
}
}