Custom Meta Data Confusing…
-
Okay, so I’ve ready through https://wpstorelocator.co/document/add-custom-meta-data-to-store-locations/ and I’ve read from other posts of people having similar challenges.
The simple question I have is “Where does the code in the final step go???”
Assuming everything else is fine, where does the following code need to exist?
add_filter( ‘wpsl_listing_template’, ‘custom_listing_template’ );
function custom_listing_template() {
global $wpsl_settings;
$listing_template = ‘<li data-store-id=”<%= id %>”>’ . “\r\n”;
$listing_template .= “\t\t” . ‘<div>’ . “\r\n”;
$listing_template .= “\t\t\t” . ‘<p><%= thumb %>’ . “\r\n”;
$listing_template .= “\t\t\t\t” . wpsl_store_header_template( ‘listing’ ) . “\r\n”;
$listing_template .= “\t\t\t\t” . ‘<span class=”wpsl-street”><%= address %></span>’ . “\r\n”;
$listing_template .= “\t\t\t\t” . ‘<% if ( address2 ) { %>’ . “\r\n”;
$listing_template .= “\t\t\t\t” . ‘<span class=”wpsl-street”><%= address2 %></span>’ . “\r\n”;
$listing_template .= “\t\t\t\t” . ‘<% } %>’ . “\r\n”;
$listing_template .= “\t\t\t\t” . ‘<span>’ . wpsl_address_format_placeholders() . ‘</span>’ . “\r\n”;
$listing_template .= “\t\t\t\t” . ‘<span class=”wpsl-country”><%= country %></span>’ . “\r\n”;
$listing_template .= “\t\t\t” . ‘</p>’ . “\r\n”;// Check if the ‘additional’ contains data before including it.
$listing_template .= “\t\t\t” . ‘<% if ( additional_url ) { %>’ . “\r\n”;
$listing_template .= “\t\t\t” . ‘<p><‘ . __( ‘Additional: ‘, ‘wpsl’ ) . ‘</p>’ . “\r\n”;
$listing_template .= “\t\t\t” . ‘<% } %>’ . “\r\n”;$listing_template .= “\t\t” . ‘</div>’ . “\r\n”;
// Check if we need to show the distance.
if ( !$wpsl_settings[‘hide_distance’] ) {
$listing_template .= “\t\t” . ‘<%= distance %> ‘ . esc_html( $wpsl_settings[‘distance_unit’] ) . ” . “\r\n”;
}$listing_template .= “\t\t” . ‘<%= createDirectionUrl() %>’ . “\r\n”;
$listing_template .= “\t” . ‘‘ . “\r\n”;return $listing_template;
}
The topic ‘Custom Meta Data Confusing…’ is closed to new replies.