• Resolved sberman

    (@sberman)


    Hi there – Trying out your plugin. So far so good except for 1 request. Is it possible to show the URL under phone/fax in search results? It shows when user clicks on store name and lands on the store listing. But we want it to show earlier on. Even if we have to edit CSS or PHP, appreciate the help!

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    If you enable the ‘show contact details’ option, and use this code in the functions.php inside your active theme folder, then the URL should show up.

    Thread Starter sberman

    (@sberman)

    Thank you for the help. This code crashed the website “syntax error”.

    Thread Starter sberman

    (@sberman)

    add_filter( ‘wpsl_listing_template’, ‘custom_listing_template’ );

    function custom_listing_template() {

    global $wpsl, $wpsl_settings;

    $listing_template = ‘<li data-store-id=”<%= id %>”>’ . “\r\n”;
    $listing_template .= “\t\t” . ‘<div class=”wpsl-store-location”>’ . “\r\n”;
    $listing_template .= “\t\t\t” . ‘<p><%= thumb %>’ . “\r\n”;
    $listing_template .= “\t\t\t\t” . wpsl_store_header_template( ‘listing’ ) . “\r\n”; // Check which header format we use
    $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”; // Use the correct address format

    if ( !$wpsl_settings[‘hide_country’] ) {
    $listing_template .= “\t\t\t\t” . ‘<span class=”wpsl-country”><%= country %></span>’ . “\r\n”;
    }

    $listing_template .= “\t\t\t” . ‘</p>’ . “\r\n”;

    // Show the phone, fax or email data if they exist.
    if ( $wpsl_settings[‘show_contact_details’] ) {
    $listing_template .= “\t\t\t” . ‘<p class=”wpsl-contact-details”>’ . “\r\n”;
    $listing_template .= “\t\t\t” . ‘<% if ( phone ) { %>’ . “\r\n”;
    $listing_template .= “\t\t\t” . ‘<span>‘ . esc_html( $wpsl->i18n->get_translation( ‘phone_label’, __( ‘Phone’, ‘wpsl’ ) ) ) . ‘: <%= formatPhoneNumber( phone ) %></span>’ . “\r\n”;
    $listing_template .= “\t\t\t” . ‘<% } %>’ . “\r\n”;
    $listing_template .= “\t\t\t” . ‘<% if ( fax ) { %>’ . “\r\n”;
    $listing_template .= “\t\t\t” . ‘<span>‘ . esc_html( $wpsl->i18n->get_translation( ‘fax_label’, __( ‘Fax’, ‘wpsl’ ) ) ) . ‘: <%= fax %></span>’ . “\r\n”;
    $listing_template .= “\t\t\t” . ‘<% } %>’ . “\r\n”;
    $listing_template .= “\t\t\t” . ‘<% if ( email ) { %>’ . “\r\n”;
    $listing_template .= “\t\t\t” . ‘<span>‘ . esc_html( $wpsl->i18n->get_translation( ’email_label’, __( ‘Email’, ‘wpsl’ ) ) ) . ‘: <%= email %></span>’ . “\r\n”;
    $listing_template .= “\t\t\t” . ‘<% } %>’ . “\r\n”;
    $listing_template .= “\t\t\t” . ‘<% if ( url ) { %>’ . “\r\n”;
    $listing_template .= “\t\t\t” . ‘<span>‘ . esc_html( $wpsl->i18n->get_translation( ‘url_label’, __( ‘Url’, ‘wpsl’ ) ) ) . ‘: “><%= url %></span>’ . “\r\n”;
    $listing_template .= “\t\t\t” . ‘<% } %>’ . “\r\n”
    $listing_template .= “\t\t\t” . ‘</p>’ . “\r\n”;
    }

    $listing_template .= “\t\t\t” . wpsl_more_info_template() . “\r\n”; // Check if we need to show the ‘More Info’ link and info
    $listing_template .= “\t\t” . ‘</div>’ . “\r\n”;
    $listing_template .= “\t\t” . ‘<div class=”wpsl-direction-wrap”>’ . “\r\n”;

    if ( !$wpsl_settings[‘hide_distance’] ) {
    $listing_template .= “\t\t\t” . ‘<%= distance %> ‘ . esc_html( $wpsl_settings[‘distance_unit’] ) . ” . “\r\n”;
    }

    $listing_template .= “\t\t\t” . ‘<%= createDirectionUrl() %>’ . “\r\n”;
    $listing_template .= “\t\t” . ‘</div>’ . “\r\n”;
    $listing_template .= “\t” . ‘‘;

    return $listing_template;
    }

    Plugin Author Tijmen Smit

    (@tijmensmit)

    The code you pasted is not identical to the code here. Not sure if the code editor your using added additional characters, but if you compare this line

    $listing_template .= “\t\t\t” . ‘<span>‘ . esc_html( $wpsl->i18n->get_translation( ‘url_label’, __( ‘Url’, ‘wpsl’ ) ) ) . ‘: “><%= url %></span>’ . “\r\n”;

    with the one I linked to, then you see it’s not the same.

    $listing_template .= "\t\t\t" . '<span><strong>' . esc_html( $wpsl->i18n->get_translation( 'url_label', __( 'Url', 'wpsl' ) ) ) . '</strong>: <a href="<%= url %>"><%= url %></a></span>' . "\r\n";

    If you make sure all code 100% matches, then it should work.

    • This reply was modified 4 years, 1 month ago by Tijmen Smit.
    • This reply was modified 4 years, 1 month ago by Tijmen Smit.
    Plugin Author Tijmen Smit

    (@tijmensmit)

    Okay, there was also an error in the code.

    Sorry about that 🙁

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Possible to show URL under phone/fax in results’ is closed to new replies.