add_action( 'give_post_form_output', 'my_custom_give_populate_amount_name_email' ); // File name: functions.php //custom code added feb 8, 2024 by matthew to create a draft hotel buildings post type and ACF field group/fields for our survey data add_action('init', 'create_hotel_post_type'); function create_hotel_post_type() { register_post_type('hotel', array( 'labels' => array( 'name' => __('Hotels'), 'singular_name' => __('Hotel') ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'hotels'), 'supports' => array('title', 'editor', 'thumbnail') ) ); } add_action('acf/init', 'my_acf_add_hotel_survey_fields'); function my_acf_add_hotel_survey_fields() { if( function_exists('acf_add_local_field_group') ): acf_add_local_field_group(array( 'key' => 'group_hotel_survey', 'title' => 'Hotel Building Survey Data', 'fields' => array( array( 'key' => 'field_current_name', 'label' => 'Current Name', 'name' => 'current_name', 'type' => 'text', ), array( 'key' => 'field_historical_name', 'label' => 'Historical Name', 'name' => 'historical_name', 'type' => 'text', ), array( 'key' => 'field_survey_date', 'label' => 'Survey Date', 'name' => 'survey_date', 'type' => 'text', ), array( 'key' => 'field_lat_lon', 'label' => 'Latitude/Longitude', 'name' => 'lat_lon', 'type' => 'text', ), array( 'key' => 'field_street_address', 'label' => 'Street Address', 'name' => 'street_address', 'type' => 'text', ), array( 'key' => 'field_zip_code', 'label' => 'Zip Code', 'name' => 'zip_code', 'type' => 'text', ), array( 'key' => 'field_historical_status', 'label' => 'Historical Contributing Status', 'name' => 'historical_status', 'type' => 'text', ), array( 'key' => 'field_national_register_district', 'label' => 'National Register District', 'name' => 'national_register_district', 'type' => 'text', ), array( 'key' => 'field_national_register_date', 'label' => 'Date of National Register District Creation', 'name' => 'national_register_date', 'type' => 'text', ), array( 'key' => 'field_local_listing', 'label' => 'Locally Listed Individually', 'name' => 'local_listing', 'type' => 'text', ), array( 'key' => 'field_local_historical_district', 'label' => 'Local Historical District', 'name' => 'local_historical_district', 'type' => 'text', ), array( 'key' => 'field_local_district_date', 'label' => 'Date of Local District', 'name' => 'local_district_date', 'type' => 'text', ), array( 'key' => 'field_construction_date', 'label' => 'Construction Date', 'name' => 'construction_date', 'type' => 'text', ), array( 'key' => 'field_architect', 'label' => 'Architect', 'name' => 'architect', 'type' => 'text', ), array( 'key' => 'field_builder', 'label' => 'Builder', 'name' => 'builder', 'type' => 'text', ), array( 'key' => 'field_significant_owner', 'label' => 'Significant Owner', 'name' => 'significant_owner', 'type' => 'text', ), array( 'key' => 'field_primary_style', 'label' => 'Primary Style', 'name' => 'primary_style', 'type' => 'text', ), array( 'key' => 'field_secondary_style', 'label' => 'Secondary Style', 'name' => 'secondary_style', 'type' => 'text', ), ), 'location' => array( array( array( 'param' => 'post_type', 'operator' => '==', 'value' => 'hotel', ), ), ), )); endif; } function create_sample_hotel_post() { // Define the new hotel post $new_post = array( 'post_title' => 'Sample Hotel', // Title of the hotel 'post_status' => 'publish', // Status of the post 'post_type' => 'hotel', // Custom post type ); // Insert the new post and get the new post ID $post_id = wp_insert_post($new_post); // Check if the post was successfully created if ($post_id == 0 || is_wp_error($post_id)) { echo 'Error creating the new hotel post'; return; } // Update ACF fields for the new hotel post $fields = array( 'field_current_name' => 'Sample Hotel Name', 'field_historical_name' => 'Historical Sample Hotel', 'field_survey_date' => '2024-02-08', 'field_lat_lon' => '40.7128° N, 74.0060° W', 'field_street_address' => '123 Main Street', 'field_zip_code' => '10001', 'field_historical_status' => 'Registered', 'field_national_register_district' => 'Historic District', 'field_national_register_date' => '2024-01-01', 'field_local_listing' => 'Yes', 'field_local_historical_district' => 'Local District', 'field_local_district_date' => '2023-12-01', 'field_construction_date' => '1920', 'field_architect' => 'John Doe Architect', 'field_builder' => 'XYZ Construction', 'field_significant_owner' => 'John Smith', ); foreach ($fields as $key => $value) { update_field($key, $value, $post_id); } echo 'New hotel post created successfully with ID: ' . $post_id; } // Uncomment the line below to run the function and create the post // create_sample_hotel_post(); ?> Events for Wed, May 17th › Live Music › – Page 3 – Miami Design Preservation League