• WPOso

    (@wordpress-oso)


    Wow, I’ve found WordPress so easy to use, it’s unbelievable. I’m ready to learn how to incorporate custom PHP includes. I imagine there are a variety of ways of doing it, but I wondered if someone could suggest the best solution.

    I want to launch a series of posts, with the titles consisting of the names of counties: e.g. King County, Whatcom County. Each page will feature (in part) the same text, including a PHP variable that will display the name of the county. For example, it might look something like this:

    Do you live in $MyCounty? If so, I'd like to hear from you. What are some of the major issues residents of $MyCounty face?

    The display would then look like this:

    Do you live in King County? If so, I’d like to hear form you. What are some of the major issues residents of King County Face?

    So I would presumably need to create a new file (in my child theme folder?), then do one of the following:

    1. somehow instruct WordPress to include the file only in pages in a certain category or marked with a certain tag

    2. type a variable (e.g. $CountyText) on each page, then replace each variable with the block of text listed above

    Anyway, can someone suggest a good way of doing this? Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP Includes 101’ is closed to new replies.