• Resolved callerpatty

    (@callerpatty)


    It appears that the “more info” doesn’t appear unless you have a phone number and an email in the entry? Is there a way to get the description to be viewed if that info isn’t available?

    All of the restaurants have details, but it doesn’t show. I added a fake phone number to Rena J’s to see if the description would show, and it does.

    In our case, we won’t necessarily be entering in a phone or email, but would like to be able to show that more info text.

    Thanks.

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi there!

    Thanks for reaching out.

    You are right, the description does not appear by default if phone, fax and e-mail are all empty. Fortunately, changing this behaviour is easy. You will have to edit your active theme’s functions.php file and add this code snippet:

    add_filter( 'wpsl_more_info_template', 'custom_more_info_template' );
    
    function custom_more_info_template() {
    
        global $wpsl_settings, $wpsl;
    
        $more_info_url = '#';
    
        $more_info_template = "\t\t\t\t" . '<% if ( description ) { %>' . "\r\n";
        $more_info_template .= "\t\t\t\t" . '<%= description %>' . "\r\n";
        $more_info_template .= "\t\t\t\t" . '<% } %>' . "\r\n";    
        
        if ( $wpsl_settings['template_id'] == 'default' && $wpsl_settings['more_info_location'] == 'info window' ) {
            $more_info_url = '#wpsl-search-wrap';
        }
    
        if ( $wpsl_settings['more_info_location'] == 'store listings' ) {
            $more_info_template .= '<% if ( !_.isEmpty( phone ) || !_.isEmpty( fax ) || !_.isEmpty( email ) ) { %>' . "\r\n";
            $more_info_template .= "\t\t\t" . '<p><a class="wpsl-store-details wpsl-store-listing" href="#wpsl-id-<%= id %>">' . esc_html( $wpsl->i18n->get_translation( 'more_label', __( 'More info', 'wpsl' ) ) ) . '</a></p>' . "\r\n";
            $more_info_template .= "\t\t\t" . '<div id="wpsl-id-<%= id %>" class="wpsl-more-info-listings">' . "\r\n";
    
            if ( !$wpsl_settings['show_contact_details'] ) {
                $more_info_template .= "\t\t\t\t" . '<p>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<% if ( phone ) { %>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<span><strong>' . esc_html( $wpsl->i18n->get_translation( 'phone_label', __( 'Phone', 'wpsl' ) ) ) . '</strong>: <%= formatPhoneNumber( phone ) %></span>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<% } %>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<% if ( fax ) { %>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<span><strong>' . esc_html( $wpsl->i18n->get_translation( 'fax_label', __( 'Fax', 'wpsl' ) ) ) . '</strong>: <%= fax %></span>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<% } %>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<% if ( email ) { %>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<span><strong>' . esc_html( $wpsl->i18n->get_translation( 'email_label', __( 'Email', 'wpsl' ) ) ) . '</strong>: <%= email %></span>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<% } %>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '</p>' . "\r\n";
            }
    
            if ( !$wpsl_settings['hide_hours'] ) {
                $more_info_template .= "\t\t\t\t" . '<% if ( hours ) { %>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<div class="wpsl-store-hours"><strong>' . esc_html( $wpsl->i18n->get_translation( 'hours_label', __( 'Hours', 'wpsl' ) ) ) . '</strong><%= hours %></div>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<% } %>' . "\r\n";
            }
    
            $more_info_template .= "\t\t\t" . '</div>' . "\r\n";
            $more_info_template .= "\t\t\t" . '<% } %>';
    
        } else {
            $more_info_template = '<p><a class="wpsl-store-details" href="' . $more_info_url . '">' . esc_html( $wpsl->i18n->get_translation( 'more_label', __( 'More info', 'wpsl' ) ) ) . '</a></p>';
        }
        
        return $more_info_template;
    }

    It uses our wpsl_more_info_template filter to modify the default behaviour where the description depends on the email, fax and phone not being empty, and instead it always shows the description no matter what.

    Please also remember to enable, in the plugin settings, the checkbox labeled as “Show a “More info” link in the store listings?”.

    I hope that helps, but get back to us otherwise.
    Regards,

    Thread Starter callerpatty

    (@callerpatty)

    Thank you for your response – that snippet works great, but can’t figure out what to adjust so that it’s in the More Info dropdown? The details show, but they aren’t wrapped in the More info block – and if any of the phone/fax/website, that more info is there, but not doing anything

    Anyway to keep the info in that more info div? Then the snippet would be perfect! I looked but can’t figure out the right thing to do

    Oh, I understand.

    Please try this code snippet instead. It will show the description inside the “More info” section:

    add_filter( 'wpsl_more_info_template', 'custom_more_info_template' );
    
    function custom_more_info_template() {
    
        global $wpsl_settings, $wpsl;
    
        $more_info_url = '#';
    
        if ( $wpsl_settings['template_id'] == 'default' && $wpsl_settings['more_info_location'] == 'info window' ) {
            $more_info_url = '#wpsl-search-wrap';
        }
    
        if ( $wpsl_settings['more_info_location'] == 'store listings' ) {    
            
            $more_info_template = '<% if ( !_.isEmpty( phone ) || !_.isEmpty( fax ) || !_.isEmpty( email ) || !_.isEmpty( description ) ) { %>' . "\r\n";
            $more_info_template .= "\t\t\t" . '<p><a class="wpsl-store-details wpsl-store-listing" href="#wpsl-id-<%= id %>">' . esc_html( $wpsl->i18n->get_translation( 'more_label', __( 'More info', 'wpsl' ) ) ) . '</a></p>' . "\r\n";
            $more_info_template .= "\t\t\t" . '<div id="wpsl-id-<%= id %>" class="wpsl-more-info-listings">' . "\r\n";
    
            $more_info_template .= "\t\t\t\t" . '<% if ( description ) { %>' . "\r\n";
            $more_info_template .= "\t\t\t\t" . '<%= description %>' . "\r\n";
            $more_info_template .= "\t\t\t\t" . '<% } %>' . "\r\n";           
            
            if ( !$wpsl_settings['show_contact_details'] ) {
                $more_info_template .= "\t\t\t\t" . '<p>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<% if ( phone ) { %>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<span><strong>' . esc_html( $wpsl->i18n->get_translation( 'phone_label', __( 'Phone', 'wpsl' ) ) ) . '</strong>: <%= formatPhoneNumber( phone ) %></span>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<% } %>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<% if ( fax ) { %>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<span><strong>' . esc_html( $wpsl->i18n->get_translation( 'fax_label', __( 'Fax', 'wpsl' ) ) ) . '</strong>: <%= fax %></span>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<% } %>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<% if ( email ) { %>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<span><strong>' . esc_html( $wpsl->i18n->get_translation( 'email_label', __( 'Email', 'wpsl' ) ) ) . '</strong>: <%= email %></span>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<% } %>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '</p>' . "\r\n";
            }
    
            if ( !$wpsl_settings['hide_hours'] ) {
                $more_info_template .= "\t\t\t\t" . '<% if ( hours ) { %>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<div class="wpsl-store-hours"><strong>' . esc_html( $wpsl->i18n->get_translation( 'hours_label', __( 'Hours', 'wpsl' ) ) ) . '</strong><%= hours %></div>' . "\r\n";
                $more_info_template .= "\t\t\t\t" . '<% } %>' . "\r\n";
            }
    
            $more_info_template .= "\t\t\t" . '</div>' . "\r\n";
            $more_info_template .= "\t\t\t" . '<% } %>';
    
        } else {
            $more_info_template = '<p><a class="wpsl-store-details" href="' . $more_info_url . '">' . esc_html( $wpsl->i18n->get_translation( 'more_label', __( 'More info', 'wpsl' ) ) ) . '</a></p>';
        }
        
        return $more_info_template;
    }

    I hope that helps ??

    Thread Starter callerpatty

    (@callerpatty)

    Perfect!!! Thanks for this helpful snippet!!

    Have a good weekend!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Store description not displaying’ is closed to new replies.