Need guidance to build a post list directory

Dear experts,

I am trying to add to a wordpress site a list of places around a downtown. It is pretty local, and only one person is going to be in charge of adding places. the outcome would be something like this:

Place1 name
Description
Address
Website
More info

Place2 name
Description
Address
Website
More info

I was thinking in using wordpress Business Directory but unfortunately it displays each post on the base page where your short-code is placed. I need each post to be placed on its own page, and it seems that is not possible according to this thread http://wordpress.org/support/topic/why-does-the-single-view-stay-on-the-main-page-it-should-be-its-own-post?replies=7#post-5078193


Since this is not a paid business directory and only one person is going to upload content, I was thinking to do that directory list using posts, categories and an alphabetical search plugin.

To create each entry for each business I was thinking to use custom fields to add the address, description etc. So far I think I am fine.


The problem that I am facing is that I  need to display a main map to locate all the business in the site. At this point I am stuck.  Could someone please give me an advice?

Thank you very much,

Winter
glepizaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tom BeckCommented:
It wouldn't take much php coding to pull all the addresses using a query that filters out the relevant posts. Then you could use Google Maps API to geocode the addresses onto a Google map.
Rowby GorenCommented:
Hello Winter,

Awhile back someone wanted me to do a Wordpress business directory.  Here are a few that I found.  I didn't build the site so I have no hands-on experience with these recommendations.  

But check them out:   Vantage has a big map on the home page.

http://demos.appthemes.com/?theme=vantage
http://wordpress.org/plugins/business-directory-plugin/

Keep in mind that the above example can be modified -- the various widgets can be turned on or off.

Rowby
DrDamnitCommented:
If you are manually uploading content to these pages, I don't see why you don't just embed a map manually as well:

https://support.google.com/maps/answer/72644?hl=en

It seems to me that it would be more work to separate these out into fields to the point where a plugin would be able to read them than to just copy / paste the embed code.
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

glepizaAuthor Commented:
Hello guys, thank you for your answers.

Just for clarification, attached goes an image of what I am trying to accomplish.
As you can say, there is just a main map that places all the Addresses that are inserted into the form for each post.
Hi, Dr Damnit, I did not understand exactly your answer. The thing is that I don´t need just to embed a map with a single direction, I need to embed a single map that localize all the addresses inserted into the post.

I guess a need a google map custom field or something… but how can I retrieve that data to place it on the map….

thank you guys, I would appreciate if you can please give me more suggestions :)
list.jpg
Tom BeckCommented:
This is what I'm suggesting. The page that displays the map and list will be a custom Wordpress page template. In that template php file you could do something like this to collect the meta data created by the custom fields.
<?php

$addresses = array(); //array to hold addresses
// get categories of locations. Gets all children of parent category "Locations" ex. "Companies", "Restuarants", etc.
$cat_title = $wpdb->get_results("SELECT t0.term_id, t0.name FROM wp_terms AS t0 INNER JOIN (SELECT t1.term_id FROM wp_term_taxonomy AS t1 WHERE t1.parent = (SELECT t3.term_id FROM wp_terms AS t3 WHERE t3.name='Locations')) AS t2 ON t2.term_id=t0.term_id");

//loop through the categories
foreach ($cat_title as $cat) {
	//find all posts associated with the current category
	$posts = $wpdb->get_results("SELECT t1.ID FROM wp_posts AS t1 INNER JOIN wp_term_relationships AS t2 ON t2.object_id = t1.ID WHERE (t1.post_status = 'Publish' OR t1.post_status = 'Private') AND t2.term_taxonomy_id = $cat->term_id ORDER BY t1.post_date ASC");
	
	//loop through the posts to get the metadata
	foreach ($posts as $post) {
		$this_meta = get_post_meta($post->ID);
		// at this point you could capture all metadata for a given post and echo to the page
		// or just push the addresses to an array and echo that for Google Maps API to Geocode onto a map
                foreach ($this_meta as $meta) {
	               if ($meta->meta_key === "Address") {
		    	     array_push($addresses, $meta->meta_key);
		       }
		}  
	}
}

?>

Open in new window

Once you have an array of addresses on the page you can use the Google Maps API to Geocode the markers for you. Many examples of how to do that online. Here is one of my own examples from another EE post:

http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/Q_28161118.html

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
glepizaAuthor Commented:
Hi Tom,

Thank you very much for helping me on this. I am going to give it try.  I am still learning to code for wordpress, so it might take me a while to get it lol. I just have two weeks to finish up the entire site and I am just so stuck on the directory part.

Thank you very much,

Winter
Tom BeckCommented:
You're welcome. Just ask new questions if you get stuck.

Thanks for the points.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WordPress

From novice to tech pro — start learning today.