Thursday, May 31, 2012

Directorypress Details page display / adding map location

One of the biggest issues I had with the Directorypress template is editing the details page.

I wanted the map location (map_location) to display on the details page.
I searched for sometime for an answer on the best way to get this done and finally came across this http://www.premiumpress.com/forums/topic/address-for-map-location-on-add-listing-form In the directory press forums.

The page that you need to edit is called _single.php
(_single.php)  found under Admin > appearance > 

Then you can add the following code to display any field or custom field: 
<?php echo get_post_meta($post->ID, "map_location", true); ?> 

you can replace "map_location" with any other field you would like to display, I actually added this code above the listing and also next to the Google map to display the address. To see how this looks on my directory press details page visit: http://georgiahealthcareprofessionals.com

I also went a little further and used the code from a Google gadget that get's directions and also added that to my _single.php page. 


 
 

3 comments:

  1. Thanks. Saved hours of searching for answer

    ReplyDelete
  2. Brilliant - this worked perfectly with your clear instructions... added it to our Oxycontin resource directory (built on the 'standard' non-responsive version of Directory Press)..

    In our example , we put it right above the Google Maps... now to have it follow the CSS style for the other fields a bit better....

    Thanks again for sharing.

    ReplyDelete

Translate