• Resolved flaminglogos

    (@flaminglogos)


    Hello,

    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,
    flaminglogos

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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:

    <ul>
      <?php
      global $id;
      wp_list_pages("title_li=&child_of=$id&show_date=modified
      &date_format=$date_format"); ?>
    </ul>
    Thread Starter flaminglogos

    (@flaminglogos)

    Thanks!
    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?

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

    Thread Starter flaminglogos

    (@flaminglogos)

    That’s just what I need.
    Thanks!

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

    https://codex.www.ads-software.com/Pages#Creating_Your_Own_Page_Templates

    and

    https://codex.www.ads-software.com/Creating_an_Archive_Index

    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:

    <?php
    /**
     * @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.

    Thread Starter flaminglogos

    (@flaminglogos)

    @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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to link many pages automatically?’ is closed to new replies.