Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

I need make a wordpress cite with all the states and cities WordPress

  • SOLVED

http://connectnationwide.com/solavei/kentucky/wellington-ky-4g-prepaid-phone-service/

I need to recreate this web site so that it has subpage "solavei" that silos onto subpages of all the us states which then silos onto subpages with all the cities of that state just as is shown in the above url

I want to make a site to promote solavei services in all the us states and cities... I need it so it works exactly the same as this site

http://connectnationwide.com/solavei/kentucky/wellington-ky-4g-prepaid-phone-service/

At the bottom you can see a list of all the states then when you click a state beneath the list it shows all the cities in the state i need it set up in the same way

http://49allyoucaneatmobile.com/

This site is another perfect example of what I need if u scroll down u can see all the states then u click a state then u scroll down again and see all the cities in that state

I need this exactly

Can anyone tell me how to do this easily in wordpress? I don't know html or php so I need to be able to do this plugins or a theme Please help?!!?

Answers (2)

2014-08-08

Dbranes answers:

Here's one simple idea if you don't want to write a single line of PHP code or modify your theme files:

To get a SEO friendly url structure like:

example.com/solavei/kentucky/wellington


you can just create a page tree for your states and cities.

You could also create a hierarchical custom post type for this, using a plugin like this [[LINK href="https://wordpress.org/plugins/custom-post-type-ui/"]]one[[/LINK]].


To display the list of cities for each state, you can, for example, use a shortcode in the page content.

Here's one plugin that might help you with that:

[[LINK href="https://wordpress.org/plugins/list-pages-shortcode/"]]https://wordpress.org/plugins/list-pages-shortcode/[[/LINK]]

From the plugin description:

<blockquote>Introduces the [list-pages], [sibling-pages] and [child-pages] shortcodes for easily displaying a list of pages within a post or page.
</blockquote>

If you have some common text to display on your pages, you might consider a template plugin like this one:

[[LINK href="https://wordpress.org/plugins/simple-post-template/"]]https://wordpress.org/plugins/simple-post-template/[[/LINK]]

---

Notice that this setup doesn't need you to manually rewrite this nice url structure or setup special theme files.

This should also work on any theme as well.

---

But If you want to write some PHP code of your own, then here are some remarks on that:

If you have the same content in many pages, you can also create your own shortcode to make your life easier:

[wpq_content]

to display some common content.

Here's a demo plugin that you can use to setup your own shortcode to list pages:

[wpq_list_pages]

or

[wpq_list_pages depth="0" title="Cities"]


/**
* Plugin Name: WPQ shortcode [wpq_list_pages]
* Plugin URI: http://www.wpquestions.com/question/showChronoLoggedIn/id/9738
* Author: dbranes
* Version: 0.0.1
*/

add_shortcode( 'wpq_list_pages', 'wpq_list_pages' );

function wpq_list_pages( $atts = array(), $content = '' ) {

if( is_page() )
{
$atts = shortcode_atts( array(
'depth' => '0',
'title' => ''
), $atts, 'wpq_list_pages' );

$args = array(
'depth' => intval( $atts['depth'] ),
'echo' => 0,
'title_li' => esc_attr( $atts['title'] ),
'sort_column' => 'menu_order, post_title',
'child_of' => get_queried_object_id(),
);
$html = '<ul class="wpq-pages">';
$html .= wp_list_pages( $args );
$html .= '</ul>';

return $html;
}
}



You can also use a filter, like [[LINK href="http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content"]]the_content()[[/LINK]], to inject HTML code into the content pages, to make life easier.

One could also write a small snippet using [[LINK href="http://codex.wordpress.org/Function_Reference/wp_insert_post"]]wp_insert_post()[[/LINK]] to automatically create the state/city page tree.

2014-08-08

Arnav Joy answers:

this page
http://connectnationwide.com/solavei/kentucky/wellington-ky-4g-prepaid-phone-service/
has overlapping html , so it is hard to understand what you want to show.