Dear Tilmen, thanks for your fast reply and your help!
Actually I did not find out how to put Code into gist, so sorry. I try to put it here…
What I did was:
1.) Code in the function.php:
****snip ***
add_filter( ‘wpsl_templates’, ‘custom_templates’ );
function custom_templates( $templates ) {
/**
* The ‘id’ is for internal use and must be unique ( since 2.0 ).
* The ‘name’ is used in the template dropdown on the settings page.
* The ‘path’ points to the location of the custom template,
* in this case the folder of your active theme.
*/
$templates[] = array (
‘id’ => ‘hbdb’,
‘name’ => ‘Holzbaudatenbank’,
‘path’ => get_stylesheet_directory() . ‘/’ . ‘wpsl-templates/custom.php’,
);
return $templates;
}
add_filter( ‘wpsl_thumb_size’, ‘custom_thumb_size’ );
function custom_thumb_size() {
$size = array( 200, 300 );
return $size;
}
add_filter( ‘wpsl_store_meta’, ‘custom_store_meta’, 10, 2 );
function custom_store_meta( $store_meta, $store_id ) {
$store_meta[‘excerpt’] = get_the_excerpt( $store_id );
return $store_meta;
}
*******
2.)
In custom.php in /themes/zakra-child/wpsl-templates/ I have inserted the complete clone of store-listings-below.php (nothing changed in it so far):
*** snip ***
?php
global $wpsl_settings, $wpsl;
$output = $this->get_custom_css();
$autoload_class = ( !$wpsl_settings[‘autoload’] ) ? ‘class=”wpsl-not-loaded”‘ : ”;
$output .= ‘<div id=”wpsl-wrap” class=”wpsl-store-below”>’ . “\r\n”;
$output .= “\t” . ‘<div class=”wpsl-search wpsl-clearfix ‘ . $this->get_css_classes() . ‘”>’ . “\r\n”;
$output .= “\t\t” . ‘<div id=”wpsl-search-wrap”>’ . “\r\n”;
$output .= “\t\t\t” . ‘<form autocomplete=”off”>’ . “\r\n”;
$output .= “\t\t\t” . ‘<div class=”wpsl-input”>’ . “\r\n”;
$output .= “\t\t\t\t” . ‘<div><label for=”wpsl-search-input”>’ . esc_html( $wpsl->i18n->get_translation( ‘search_label’, __( ‘Your location’, ‘wpsl’ ) ) ) . ‘</label></div>’ . “\r\n”;
$output .= “\t\t\t\t” . ‘<input id=”wpsl-search-input” type=”text” value=”‘ . apply_filters( ‘wpsl_search_input’, ” ) . ‘” name=”wpsl-search-input” placeholder=”” aria-required=”true” />’ . “\r\n”;
$output .= “\t\t\t” . ‘</div>’ . “\r\n”;
if ( $wpsl_settings[‘radius_dropdown’] || $wpsl_settings[‘results_dropdown’] ) {
$output .= “\t\t\t” . ‘<div class=”wpsl-select-wrap”>’ . “\r\n”;
if ( $wpsl_settings[‘radius_dropdown’] ) {
$output .= “\t\t\t\t” . ‘<div id=”wpsl-radius”>’ . “\r\n”;
$output .= “\t\t\t\t\t” . ‘<label for=”wpsl-radius-dropdown”>’ . esc_html( $wpsl->i18n->get_translation( ‘radius_label’, __( ‘Search radius’, ‘wpsl’ ) ) ) . ‘</label>’ . “\r\n”;
$output .= “\t\t\t\t\t” . ‘<select id=”wpsl-radius-dropdown” class=”wpsl-dropdown” name=”wpsl-radius”>’ . “\r\n”;
$output .= “\t\t\t\t\t\t” . $this->get_dropdown_list( ‘search_radius’ ) . “\r\n”;
$output .= “\t\t\t\t\t” . ‘</select>’ . “\r\n”;
$output .= “\t\t\t\t” . ‘</div>’ . “\r\n”;
}
if ( $wpsl_settings[‘results_dropdown’] ) {
$output .= “\t\t\t\t” . ‘<div id=”wpsl-results”>’ . “\r\n”;
$output .= “\t\t\t\t\t” . ‘<label for=”wpsl-results-dropdown”>’ . esc_html( $wpsl->i18n->get_translation( ‘results_label’, __( ‘Results’, ‘wpsl’ ) ) ) . ‘</label>’ . “\r\n”;
$output .= “\t\t\t\t\t” . ‘<select id=”wpsl-results-dropdown” class=”wpsl-dropdown” name=”wpsl-results”>’ . “\r\n”;
$output .= “\t\t\t\t\t\t” . $this->get_dropdown_list( ‘max_results’ ) . “\r\n”;
$output .= “\t\t\t\t\t” . ‘</select>’ . “\r\n”;
$output .= “\t\t\t\t” . ‘</div>’ . “\r\n”;
}
$output .= “\t\t\t” . ‘</div>’ . “\r\n”;
}
if ( $this->use_category_filter() ) {
$output .= $this->create_category_filter();
}
$output .= “\t\t\t\t” . ‘<div class=”wpsl-search-btn-wrap”><input id=”wpsl-search-btn” type=”submit” value=”‘ . esc_attr( $wpsl->i18n->get_translation( ‘search_btn_label’, __( ‘Search’, ‘wpsl’ ) ) ) . ‘”></div>’ . “\r\n”;
$output .= “\t\t” . ‘</form>’ . “\r\n”;
$output .= “\t\t” . ‘</div>’ . “\r\n”;
$output .= “\t” . ‘</div>’ . “\r\n”;
if ( $wpsl_settings[‘reset_map’] ) {
$output .= “\t” . ‘<div class=”wpsl-gmap-wrap”>’ . “\r\n”;
$output .= “\t\t” . ‘<div id=”wpsl-gmap” class=”wpsl-gmap-canvas”></div>’ . “\r\n”;
$output .= “\t” . ‘</div>’ . “\r\n”;
} else {
$output .= “\t” . ‘<div id=”wpsl-gmap” class=”wpsl-gmap-canvas”></div>’ . “\r\n”;
}
$output .= “\t” . ‘<div id=”wpsl-result-list”>’ . “\r\n”;
$output .= “\t\t” . ‘<div id=”wpsl-stores” ‘. $autoload_class .’>’ . “\r\n”;
$output .= “\t\t\t” . ‘
‘ . “\r\n”;
$output .= “\t\t” . ‘</div>’ . “\r\n”;
$output .= “\t\t” . ‘<div id=”wpsl-direction-details”>’ . “\r\n”;
$output .= “\t\t\t” . ‘
‘ . “\r\n”;
$output .= “\t\t” . ‘</div>’ . “\r\n”;
$output .= “\t” . ‘</div>’ . “\r\n”;
if ( $wpsl_settings[‘show_credits’] ) {
$output .= “\t” . ‘<div class=”wpsl-provided-by”>’. sprintf( __( “Search provided by %sWP Store Locator%s”, “wpsl” ), ““, “” ) .'</div>’ . “\r\n”;
}
$output .= ‘</div>’ . “\r\n”;
return $output;
**** snap ****
3.)
Now I tried to find out where to
“If you’re already using a custom search results template, then just include line 26 – 28 IN YOUR EXISTING TEMPLATE CODE to make the post content show up.”
( https://wpstorelocator.co/document/include-post-content-in-search-results/ )
and then change ‘description’ into ‘excerpt’ in these lines like you described here:
https://www.ads-software.com/support/topic/display-store-excerpt-instead-of-post-content/
Where I fail is: Where exactly should I put the three line of code (26-28) into the template file?
Your code example on the link above shows not the template, but the function.php code which is completely other than the template code. As I use a custom template, I only need theses three lines, you wrote, and put it into the TEMPLATE (or did I misunderstand this????).
So to where in the template do I put it? There ist nothing similar to the (function.php) example given in the ‘store-listings-below.php’ template code…
I want to use the custom template in order to reorder the store info output. Plus I might have to use some additional meta data etc. so I thought a custom template would be best to do all of this. But in the tempate given (store-listings-below.php) I can’t locate the output of all the single data fields, like phone, address and so far where I – as I think – will have to style an include fields as to my needs…? (Unfortunately my php skills are limited, but normally I recognise placeholders in templates and can reorder these.)
That written, your how-to for custom meta data also shows the referring template parts as defined in function.php:
https://wpstorelocator.co/document/add-custom-meta-data-to-store-locations/
My aim is to show architectural locations. I’d like to list the category, would love to have tags, like to have something like architect and year of building, will not need opening hours… So a couple of customization ahead.
Therefor I wanted the custom template to edit all this/insert the created fields there. Wrong?
Best regards
nici-