abstract-acf-legacy-location.php
3 months ago
abstract-acf-location.php
3 months ago
class-acf-location-attachment.php
3 months ago
class-acf-location-comment.php
3 months ago
class-acf-location-current-user-role.php
3 months ago
class-acf-location-current-user.php
3 months ago
class-acf-location-nav-menu-item.php
3 months ago
class-acf-location-nav-menu.php
3 months ago
class-acf-location-page-parent.php
3 months ago
class-acf-location-page-template.php
3 months ago
class-acf-location-page-type.php
3 months ago
class-acf-location-page.php
3 months ago
class-acf-location-post-category.php
3 months ago
class-acf-location-post-format.php
3 months ago
class-acf-location-post-status.php
3 months ago
class-acf-location-post-taxonomy.php
3 months ago
class-acf-location-post-template.php
3 months ago
class-acf-location-post-type.php
3 months ago
class-acf-location-post.php
3 months ago
class-acf-location-taxonomy.php
3 months ago
class-acf-location-user-form.php
3 months ago
class-acf-location-user-role.php
3 months ago
class-acf-location-widget.php
3 months ago
index.php
1 year ago
class-acf-location-post-format.php
85 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package ACF |
| 4 | * @author WP Engine |
| 5 | * |
| 6 | * © 2026 Advanced Custom Fields (ACF®). All rights reserved. |
| 7 | * "ACF" is a trademark of WP Engine. |
| 8 | * Licensed under the GNU General Public License v2 or later. |
| 9 | * https://www.gnu.org/licenses/gpl-2.0.html |
| 10 | */ |
| 11 | |
| 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | exit; // Exit if accessed directly |
| 14 | } |
| 15 | |
| 16 | if ( ! class_exists( 'ACF_Location_Post_Format' ) ) : |
| 17 | |
| 18 | class ACF_Location_Post_Format extends ACF_Location { |
| 19 | |
| 20 | /** |
| 21 | * Initializes props. |
| 22 | * |
| 23 | * @date 5/03/2014 |
| 24 | * @since 5.0.0 |
| 25 | * |
| 26 | * @param void |
| 27 | * @return void |
| 28 | */ |
| 29 | public function initialize() { |
| 30 | $this->name = 'post_format'; |
| 31 | $this->label = __( 'Post Format', 'acf' ); |
| 32 | $this->category = 'post'; |
| 33 | $this->object_type = 'post'; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Matches the provided rule against the screen args returning a bool result. |
| 38 | * |
| 39 | * @date 9/4/20 |
| 40 | * @since 5.9.0 |
| 41 | * |
| 42 | * @param array $rule The location rule. |
| 43 | * @param array $screen The screen args. |
| 44 | * @param array $field_group The field group settings. |
| 45 | * @return boolean |
| 46 | */ |
| 47 | public function match( $rule, $screen, $field_group ) { |
| 48 | |
| 49 | // Check screen args. |
| 50 | if ( isset( $screen['post_format'] ) ) { |
| 51 | $post_format = $screen['post_format']; |
| 52 | } elseif ( isset( $screen['post_id'] ) ) { |
| 53 | $post_type = get_post_type( $screen['post_id'] ); |
| 54 | $post_format = get_post_format( $screen['post_id'] ); |
| 55 | |
| 56 | // Treat new posts (that support post-formats) without a saved format as "standard". |
| 57 | if ( ! $post_format && post_type_supports( $post_type, 'post-formats' ) ) { |
| 58 | $post_format = 'standard'; |
| 59 | } |
| 60 | } else { |
| 61 | return false; |
| 62 | } |
| 63 | |
| 64 | // Compare rule against $post_format. |
| 65 | return $this->compare_to_rule( $post_format, $rule ); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Returns an array of possible values for this rule type. |
| 70 | * |
| 71 | * @date 9/4/20 |
| 72 | * @since 5.9.0 |
| 73 | * |
| 74 | * @param array $rule A location rule. |
| 75 | * @return array |
| 76 | */ |
| 77 | public function get_values( $rule ) { |
| 78 | return get_post_format_strings(); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | // initialize |
| 83 | acf_register_location_type( 'ACF_Location_Post_Format' ); |
| 84 | endif; // class_exists check |
| 85 |