Astra_Target_Rules_Fields::get_post_target_rule_options( object $post_type, object $taxonomy, mixed $consider_type = false )
Get target rules for generating the markup for rule selector.
Description
Parameters
- $post_type
-
(object) (Required) post type parameter.
- $taxonomy
-
(object) (Required) taxonomy for creating the target rule markup.
- $consider_type
-
(mixed) (Optional) consider type for dealing with rule options.
Default value: false
Source
File: classes/modules/target-rule/class-astra-target-rules-fields.php
public static function get_post_target_rule_options( $post_type, $taxonomy ) { $post_key = str_replace( ' ', '-', strtolower( $post_type->label ) ); $post_label = ucwords( $post_type->label ); $post_name = $post_type->name; $post_option = array(); /* translators: %s post label */ $all_posts = sprintf( __( 'All %s', 'astra-addon' ), $post_label ); $post_option[ $post_name . '|all' ] = $all_posts; if ( 'pages' != $post_key ) { /* translators: %s post label */ $all_archive = sprintf( __( 'All %s Archive', 'astra-addon' ), $post_label ); $post_option[ $post_name . '|all|archive' ] = $all_archive; } if ( in_array( $post_type->name, $taxonomy->object_type ) ) { $tax_label = ucwords( $taxonomy->label ); $tax_name = $taxonomy->name; /* translators: %s taxonomy label */ $tax_archive = sprintf( __( 'All %s Archive', 'astra-addon' ), $tax_label ); $post_option[ $post_name . '|all|taxarchive|' . $tax_name ] = $tax_archive; } $post_output['post_key'] = $post_key; $post_output['label'] = $post_label; $post_output['value'] = $post_option; return $post_output; }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |