• Resolved lukapeteh

    (@lukapeteh)


    Hello,

    A while ago the plugin stopped working beacuse of the issue with APIs. Just now I fixed the issue with Google support but I get an error in displaying the table of locations bellow the map.

    This is the errror: “Warning: Undefined variable $listing_template in /home/zspm/public_html/wp-content/themes/betheme-child/functions.php on line 171”

    I know it’s a lot to read but I really need your help. The map was built about 5 years ago and also another developer was working on the project.

    Can you maybe see anything that stands out in this code? My guess is that the code was custom built for displaying the table with results…

    Ps.: I didn’t change anything in the “functions.php” file before the map stopped working.

    Any tips are welcome. Thanks in advance
    Luka

    function custom_listing_template() {
    	
        global $wpsl, $wpsl_settings;
        
    $listing_template .= '
        <div class="wrap-li" data-store-id="<%= id %>">
            <div class="wrap-row">
    
                <div class="prvi-del sirina-dela">
                ' . wpsl_store_header_template( 'listing' ) . '
                </div>
                <!-- END prvi-del -->
    
                <div class="drugi-del sirina-dela">
                    <% if ( povezava_url ) { %>
    					<a class="" href="<%= povezava_url %>" target="_blank">
    						<% if ( address ) { %><span class="maps-ulica"><i class="icon-home"></i><%= address %><% } %>
    						<% if ( address2 ) { %><%= address2 %><% } %>, ' . wpsl_address_format_placeholders() . '</a></span>
    					</a>
                    <% } else { %>
    					<% if ( address ) { %><span class="maps-ulica"><i class="icon-home"></i><%= address %><% } %>
                    	<% if ( address2 ) { %><%= address2 %><% } %>, ' . wpsl_address_format_placeholders() . '</a></span>
                    <% } %>
                </div>
                <!-- END drugi-del -->
    
            
                <div class="tretji-del sirina-dela">
                    <% if ( phone ) { %>
                    <span><i class="icon-phone"></i> <a class="povezava-telefon" href="tel:<%= formatPhoneNumber( phone ) %>"><%= formatPhoneNumber( phone ) %></a></span>
                    <% } %>
                </div>
                <!-- END tretji-del -->
    
                <div class="cetrti-del sirina-dela">
                    <% if ( email ) { %>
                    <span><i class="icon-mail"></i> <a class="povezava-mail" href="mailto:<%= email %>"><%= email %></a></span>
                    <% } %>
                </div>
                <!-- END cetrti-del -->
            
                <div class="peti-del sirina-dela">
                    <% if ( appointment_url ) { %>
                    <span><a class="povezava-drustvo" href="<%= appointment_url %>">' . __( 'Vec o drustvu', 'wpsl' ) . '</a></span>
                    <% } %>
                </div>
                <!-- END peti-del -->
            
            </div>
        </div>
    
        ';
    
        return $listing_template;
    }

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

Viewing 1 replies (of 1 total)
  • Hi there, thanks for reaching out.

    Yes, it turns out there is an error in the function that you are sending. The first appearance of the $listing_template varialbe is actually using the “concatenation assignment” operator ( .= ), which requires the variable to be defined first. So please change the following:

    function custom_listing_template() {
    	
        global $wpsl, $wpsl_settings;
        
    $listing_template .= '
    

    to this

    function custom_listing_template() {
    	
        global $wpsl, $wpsl_settings;
        
    $listing_template = '
    

    Please notice the difference, in the first case the operator is “point equals” (.=). In the second case, the operator is just “equals” (=).

    Try that out and get back if that does not do the trick.
    Regards,

Viewing 1 replies (of 1 total)
  • The topic ‘Warning: Undefined variable $listing_template’ is closed to new replies.