Astra_Target_Rules_Fields::get_post_selection( string $post_type )
Get post selection.
Description
Parameters
- $post_type
-
(string) (Required) Post Type.
Return
(object) Posts.
Source
File: classes/modules/target-rule/class-astra-target-rules-fields.php
public static function get_post_selection( $post_type ) { $query_args = array( 'post_type' => $post_type, 'posts_per_page' => -1, 'post_status' => 'publish', ); $all_headers = get_posts( $query_args ); $headers = array(); if ( ! empty( $all_headers ) ) { $headers = array( '' => __( 'Select', 'astra-addon' ), ); foreach ( $all_headers as $i => $data ) { $headers[ $data->ID ] = $data->post_title; } } return $headers; }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |