Support has been upgraded!
The Support Forum is closed. Not to worry! Providing the top quality support you expect and we're known for will continue! We're not ending support, just changing where you submit requests. This will provide you with the best experience possible.
Premium Support
Have you purchased an addon for Connections such as one of our premium templates or extensions with a valid license and you need help?
Please open a Support Ticket in your user account.
Free Support
Are you using the free Connections plugin? Don't worry, you are still very important to us! We are still providing you with the same high quality support that we're known for.
Please open a new support topic in the WordPress support forums for Connections.
Tagged: 0.8.14, getAddressBlock, Tile Plus
- This topic has 4 replies, 2 voices, and was last updated 12 years ago by
David Rogers.
-
AuthorPosts
-
08/01/2014 at 1:16 pm #299334
David Rogers
ParticipantHow can I make it so that the address entry shows up on one line with the fields separated by commas in a card-single.php template?
Example:
1124 Main Street, My Town, CA, 95441, USA
Also, on the directory card.php template, how can I show only the city, state, country on one line without the street address or the zip code?
Example:
My Town, CA, USA
I’m using the tile-plus template.
-
This topic was modified 12 years ago by
David Rogers.
-
This topic was modified 12 years ago by
David Rogers.
08/02/2014 at 8:40 am #299399Steven Zahm
Keymaster@ David
In the
card-single.phpyou would change this line:if ( $atts['show_addresses'] ) $entry->getAddressBlock( array( 'format' => $atts['addr_format'] , 'type' => $atts['address_types'] ) );to this:
if ( $atts['show_addresses'] ) $entry->getAddressBlock( array( 'format' => '%line1%, %line2%, %line3%, %city%, %state%, %zipcode%, %country%' , 'type' => $atts['address_types'] ) );In the
card.phpfile, change this line:if ( $atts['show_addresses'] ) $entry->getAddressBlock( array( 'format' => $atts['addr_format'] , 'type' => $atts['address_types'] ) );to this:
if ( $atts['show_addresses'] ) $entry->getAddressBlock( array( 'format' => '%city%, %state%, %country%' , 'type' => $atts['address_types'] ) );No, in both the
tile-plus.cssandtile-plus-single.cssfiles you need to add CSS to override the block layout. The following CSS should do the trick:#cn-slim-plus span.adr span.street-address { display: inline-block; } #cn-slim-plus span.adr span.extended-address { display: inline-block; } #cn-slim-plus span.adr span.country-name { display: inline-block; } #cn-slim-plus span.adr span.geo, div#cn-list span.adr span.geo span.latitude,div#cn-list span.adr span.geo span.longitude { display: inline-block; }Lastly, instead of modding these file directly, I suggest making copies and use this method for the PHP files and this method for the CSS files so your changes are update safe.
Hope that helps!
08/02/2014 at 1:47 pm #299434David Rogers
ParticipantThat works great with one small hitch. If a field is blank, it still gets a comma. Is there some way to remove the empty fields?
Currently I get this:
1260 Some St, , , Some Town, CA, 94608, USA
Would like to get this:
1260 Some St, , , Some Town, CA, 94608, USA
08/02/2014 at 2:28 pm #299439Steven Zahm
Keymaster@ David
If you will have empty fields, yes the commas will show up. The alternative is to use a CSS approach to handle adding commas. Fir remove them from the gettAddressBlock format option, then use this CSS:
#cn-slim-plus span.adr span.street-address { display: inline-block; } #cn-slim-plus span.adr span.street-address:after { content: ','; } #cn-slim-plus span.adr span.extended-address { display: inline-block; } #cn-slim-plus span.adr span.extended-address:after { content: ','; } #cn-slim-plus span.locality:after { content: ',' } #cn-slim-plus span.region:after { content: ',' } #cn-slim-plus span.postal-code:after { content: ',' } #cn-slim-plus span.adr span.country-name { display: inline-block; } #cn-slim-plus span.adr span.geo, div#cn-list span.adr span.geo span.latitude,div#cn-list span.adr span.geo span.longitude { display: inline-block; }08/02/2014 at 2:55 pm #299440David Rogers
ParticipantThat worked just great, thank you!
-
This topic was modified 12 years ago by
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.
