Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter James Spencer

    (@js-enigma)

    HI Tijmen,

    Thanks for the code although for now I will stick with the code I have for now as this seems to work for me at least.

    Thanks again.
    James

    Thread Starter James Spencer

    (@js-enigma)

    Hi Tijmen,

    All sorted now thanks i have had to do the following and would be interested to know if there is a better way to accomplish this.

    Inside the store_meta_filter
    $store_meta['url'] = str_replace("https://", "", $store_meta['url']);

    Then inside the custom_listing_template
    $new_url = str_replace("https://", "", "<%= url %>");

    Plus this to display
    $listing_template .= "\t\t\t\t" . '<span><a href="https://<%= url %>">' . $new_url . '</a></span>' . "\r\n";

    This now shows the web address without the https:// protocol and also maintains the correct link when a user clicks.

    Thanks again
    James

    Thread Starter James Spencer

    (@js-enigma)

    Hi Tijmen,

    Glad to see I was on the right lines but I am unsure how to add this to the code for the meta_filter I posted before.

    Can you point me in the right direction at all please?

    Thanks again
    James

    Thread Starter James Spencer

    (@js-enigma)

    Hi Tijmen,

    I don’t have firebug installed at the moment but I have looked in firefox developer edition. Hoping I am looking in the correct area but I went into Network > Response and where url is returned all the url’s have https:// prior to the actual web address.

    I am assuming this is therefore returned through the ajax?

    Can you suggest anything I can do to help this?

    Thanks for all your help.
    James

    Thread Starter James Spencer

    (@js-enigma)

    I have not quite got it live as yet.

    Within the filter I put this into a new variable like this $new_url = str_replace('https://', '', '<%= url %>');

    Then called this like so $info_window_template .= "\t\t" . '<span><a href="<%= url %>">' . $new_url . '</span>' . "\r\n";

    I have tried a few different options to accomplish this including str_replace above and ltrim, both pass the url and show the web address but continue to tag the protocol first. This is fine to actually have as a link but not keen on on showing this on the the front end in this case.

    Could I add the url to the filter for store_meta? If so I am assuming i can add to this?

    add_filter( 'wpsl_store_meta', 'custom_store_meta', 10, 2 );
    
    function custom_store_meta( $store_meta, $store_id ) {
    
        $terms = wp_get_post_terms( $store_id, 'wpsl_store_category' );
    
        if ( count( $terms ) > 1 ) {
            $location_terms = array();
    
            foreach ( $terms as $term ) {
                $location_terms[] = $term->name;
            }
    
            $store_meta['terms'] = implode( ', ', $location_terms );
        } else if ( !empty( $terms ) ) {
            $store_meta['terms'] = $terms[0]->name;
        }
    
        return $store_meta;
    }

    Any help would be appreciated.

    Thanks
    James

    Thread Starter James Spencer

    (@js-enigma)

    Hi Tijmen,

    Sorry for the delay in replying, initially this now looks to be working.

    I will keep testing to make sure and feedback the results.

    Thanks again for your hard work.

    Thread Starter James Spencer

    (@js-enigma)

    Just a quick update, when I have added the new code the dropdowns for search radius and results are missing also.

    Thread Starter James Spencer

    (@js-enigma)

    Hi Tijmen,

    I added the code to the development site I have and once I minify the code the search function stops working completely and no results are shown.

    I think I must be doing something wrong as prior to this everything works.

    Hope you can help.
    James

    Thread Starter James Spencer

    (@js-enigma)

    There are & in the title of some stores yes.

    Currently the site isn’t live i’m afraid.

Viewing 9 replies - 1 through 9 (of 9 total)