コード例 #1
0
 /**
  * @return WPSEO_Config_Field_Choice_Post_Type[] List of fields.
  */
 public function get_fields()
 {
     if (empty(self::$fields)) {
         $fields = array();
         $post_types = get_post_types(array('public' => true), 'objects');
         if (!empty($post_types)) {
             foreach ($post_types as $post_type => $post_type_object) {
                 $label = $this->decode_html_entities($post_type_object->label);
                 $field = new WPSEO_Config_Field_Choice_Post_Type($post_type, $label);
                 $this->add_custom_properties($post_type, $field);
                 $fields[] = $field;
             }
         }
         self::$fields = $fields;
     }
     return self::$fields;
 }