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


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

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

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)


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:

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=""]]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=""]][[/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.

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

[[LINK href=""]][[/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:


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 depth="0" title="Cities"]

* Plugin Name: WPQ shortcode [wpq_list_pages]
* Plugin URI:
* 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=""]]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=""]]wp_insert_post()[[/LINK]] to automatically create the state/city page tree.


Arnav Joy answers:

this page
has overlapping html , so it is hard to understand what you want to show.