add_filter( 'wpsl_listing_template', 'custom_listing_template' ); function custom_listing_template() { $sections = wpsl_get_service( 'template_sections' ); $settings = wpsl_get_service( 'wpsl_settings' ); $icons = $settings->get( 'appearance', 'icons', [] ); $icons_enabled = ! empty( $icons['enabled'] ); $cta = $settings->get( 'appearance', 'cta', [] ); $contact_details = (array) $settings->get( 'ux', 'contact_details', [] ); $hours = (array) $settings->get( 'ux', 'hours', [] ); $description = (array) $settings->get( 'ux', 'description', [] ); $is_name_search = $sections->is_name_search(); $listing_template = '
<%= my_textinput %>
' . "\r\n"; $listing_template .= "\t\t" . '<% } %>' . "\r\n"; // The phone, fax and email, if "Below the address in the search results" // is selected for the contact details. if ( in_array( 'search_results', $contact_details, true ) ) { $listing_template .= $sections->contact_details(); } // The opening hours, if "Below the address in the search results" // is selected for the opening hours. if ( in_array( 'search_results', $hours, true ) ) { $listing_template .= "\t\t" . '<% if ( typeof hours !== "undefined" && hours ) { %>' . "\r\n"; if ( $icons_enabled ) { $listing_template .= "\t\t" . '' . "\r\n"; } else { $listing_template .= "\t\t" . '<%= hours %>' . "\r\n"; } $listing_template .= "\t\t" . '<% } %>' . "\r\n"; } // The "temporarily closed" or "permanently closed" notice. $status_class = ( $icons_enabled ) ? 'wpsl-location-status wpsl-icon-attention' : 'wpsl-location-status'; $listing_template .= "\t\t" . '<% if ( typeof location_status !== "undefined" && location_status ) { %>' . "\r\n"; $listing_template .= "\t\t" . '<%= location_status %>
' . "\r\n"; $listing_template .= "\t\t" . '<% } %>' . "\r\n"; // The post content, if "Below the address in the search results" // is selected for the post content. if ( in_array( 'search_results', $description, true ) ) { $listing_template .= "\t\t" . '<% if ( typeof description !== "undefined" && description ) { %>' . "\r\n"; $listing_template .= "\t\t" . '<%= description %>
' . "\r\n"; $listing_template .= "\t\t" . '<% } %>' . "\r\n"; } // The "More info" link and content, if any of the // "Location(s) of ..." settings includes the "more info" section. if ( in_array( 'more_info', $contact_details, true ) || in_array( 'more_info', $hours, true ) || in_array( 'more_info', $description, true ) ) { $listing_template .= "\t\t" . $sections->more_info_template() . "\r\n"; } $listing_template .= "\t" . '