Ready to get started?Download WordPress


[resolved] How to link many pages automatically? (7 posts)

  1. flaminglogos
    Posted 4 years ago #


    I've got a request to build a lot of pages in a WP site that are related to each other. It's basically two lists (let's call them cities and stadiums), and I'd like to have a page with a list of cities. Next to each city I'd like to list the stadiums that are in that city (and the other way around if the visitor is looking at the stadiums page).

    I'd use a database on any of my non-WP sites, but I need to know if there are any plug-ins that would allow me to create such a database in WP? Or should I look at using the taxonomy functions within WP, or possibly creating a custom plug-in?

    Thank you for any direction that you can provide me,

  2. Joe Hall
    Posted 4 years ago #

    I think you should make the Cities pages first and then make the stadium pages as children of their corresponding city page then you can get a list of pages parent and child by using something like:

      global $id;
      &date_format=$date_format"); ?>
  3. flaminglogos
    Posted 4 years ago #

    I will give this a try.

    Where in the Docs would I find out more about this type of solution (or what do you call the use of these variables)?

    Can this code be placed in the content section of my page (through the wp-admin interface, or would I add it one of my .PHP files?

  4. Joe Hall
    Posted 4 years ago #

    You are going to need to add it to your theme's php files.

  5. flaminglogos
    Posted 4 years ago #

    That's just what I need.

  6. henkholland
    Posted 4 years ago #

    But if you have many cities, putting it in your menu, won't work, is it?




    together ia what I did.

    Make a page called "Cities" and link to it from your menu.

    According to link one, make a citypagetemplate.php
    Start with:

     * @package WordPress
     * @subpackage Default_Theme
    Template Name: citypagetemplate
    <?php get_header(); ?>
    <?php include('left_sidebar.php'); ?>
    etc etc

    On that page put also:
    <?php wp_list_pages('sort_column=menu_order& child_of=1014&title_li='); ?> replace 1014 with the ID of your cities page.

    This will get you a list with all the children (title's) as links.

  7. flaminglogos
    Posted 4 years ago #

    @henkholland: That's interesting. I hadn't thought about what the menu will look like with all of these pages in it. I'll give this a try, as well.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.