[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Need guidance to build a post list directory

Posted on 2014-01-07
7
Medium Priority
?
370 Views
Last Modified: 2014-01-07
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
0
Comment
Question by:glepiza
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 38

Expert Comment

by:Tom Beck
ID: 39762832
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.
0
 
LVL 9

Assisted Solution

by:Rowby Goren
Rowby Goren earned 400 total points
ID: 39762892
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
0
 
LVL 32

Assisted Solution

by:DrDamnit
DrDamnit earned 400 total points
ID: 39762937
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.
0
Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

 

Author Comment

by:glepiza
ID: 39763366
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
0
 
LVL 38

Accepted Solution

by:
Tom Beck earned 1200 total points
ID: 39763522
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
0
 

Author Comment

by:glepiza
ID: 39763969
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
0
 
LVL 38

Expert Comment

by:Tom Beck
ID: 39763979
You're welcome. Just ask new questions if you get stuck.

Thanks for the points.
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since I am currently running into this issue right now as I type this, I though I would share my experiences with moving a ModX Revolution site from one server to another.  It is not an easy task, but can be accomplished rather easily. The first …
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question