Title: PHP Includes 101
Last modified: September 1, 2016

---

# PHP Includes 101

 *  [WPOso](https://wordpress.org/support/users/wordpress-oso/)
 * (@wordpress-oso)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/php-includes-101/)
 * 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)

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [9 years, 11 months ago](https://wordpress.org/support/topic/php-includes-101/#post-7459060)
 * this is what custom fields are for! use a custom field on the page to set the
   value and use a shortcode (for example [county]) in the text
 * Custom Fields
    [https://codex.wordpress.org/Custom_Fields](https://codex.wordpress.org/Custom_Fields)
 * Shortcodes
    [https://codex.wordpress.org/Shortcode_API](https://codex.wordpress.org/Shortcode_API)
 *  Thread Starter [WPOso](https://wordpress.org/support/users/wordpress-oso/)
 * (@wordpress-oso)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/php-includes-101/#post-7459070)
 * Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘PHP Includes 101’ is closed to new replies.

## Tags

 * [php include](https://wordpress.org/support/topic-tag/php-include/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [WPOso](https://wordpress.org/support/users/wordpress-oso/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/php-includes-101/#post-7459070)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
