Support » Plugin: Stellar Places » Styling the address

  • Resolved mosabua

    (@mosabua)


    Hi,

    I have another question … is there a way to reorganise the fields for the adresse (in single.php $address->render(); and the <%= description %> in info-window.html)

    Right now Stellar Place give you the adresse like this:
    Street
    City, Province, ZIP Code

    but in many countries thats different (like here in Austria).
    We use something like:
    Street
    ZIP Code City, Country

    Thanks again
    werner

    https://wordpress.org/plugins/stellar-places/

Viewing 1 replies (of 1 total)
  • Plugin Author Micah Wood

    (@woodent)

    @mosabua,

    The <%= description =%> field in info-window.html is actually pulled from the excerpt. When there is no excerpt defined, it will pull from the content. Since the address is added to the content via the single.php file, the output is actually controlled by the $address->render() code in that template.

    I was just looking at the render() method in the Stellar_Places_Postal_Address and realized that the stellar_places_postal_address_html filter doesn’t necessarily provide access to everything you would need to properly filter the output for your use case.

    One approach would be to copy the code in the get_html() method from the Stellar_Places_Postal_Address class into your single.php template, reorder things as needed and then output the result.

    If you are going to be working with a heterogenous collection of international addresses, then you may just want to replace $address->render() with this:

    echo esc_html( get_post_meta( get_the_ID(), '_stlr_places_formatted_address', true ) );

    It looks like I need to think about a better way to handle international addresses. Perhaps a filter that would allow you to update the output based on the country would be appropriate.

Viewing 1 replies (of 1 total)
  • The topic ‘Styling the address’ is closed to new replies.