Parameterized Templates for Dynamic Page Content (2 posts)

  1. jeremylemaire
    Posted 3 years ago #

    I am implementing a solution to create WordPress pages with SEO content for a particular topic. The ultimate goal being a series of Search Engine Optimized landing pages were the content is dynamically generated for the users particular location. Because the number of locations can be very large I would like to avoid creating 10's if not 100's of pages for each location.

    Step One: Custom Headers
    My initial approach is going to be creating custom headers containing the appropriate keywords for each location using this method.

    Step Two: Parameterized Templates for Dynamic Page Content
    So far so good. But additionally I would like to have many pages or a series of pages that have some content which is the same and some which is not. Therefore I need to have only pieces of the page's content section dynamically generated based on the location. To do this I was going to somehow modify the base Page Template (page.php) to contain a conditional based on an optional location parameter that looks something like this:

    <section class="entry">
      <?php if(has_location()) : the_location_content(); else : the_content();   ?>

    This seems like a lot of hand coding to create dynamic content. I come from a Spring MVC (Tiles) background where you can easily create dynamic templates for portions of your pages. Being new to WordPress I am not sure of the best way to do it.

    Is there a better way of creating this dynamic content The WordPress Way using built in widgets or plugins so that I do not have to create new pages for each location. Am I on the right track with modifying the page.php file?

  2. kayayurt
    Posted 2 years ago #

    Hello Jeremy,
    Were you able to resolve this issue? I have the same problem.
    Please let me know if you did.

    [ Signature moderated and support is offered via the forums only and not e-mail. ]

Topic Closed

This topic has been closed to new replies.

About this Topic