Title: Template Tutorial &#8211; Error
Last modified: August 19, 2016

---

# Template Tutorial – Error

 *  Resolved [tsalagi](https://wordpress.org/support/users/tsalagi/)
 * (@tsalagi)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/template-tutorial-error/)
 * I’m currently leearning to create templates in WordPress. I’ve downloaded a tutorial
   from Nettuts.com. I’m creating the functions.php file and I am getting an error.
 * I’ve commented out the code in blocks and found the block I think is causing 
   php to complain. Here is the block of code from the `functions.php file.
    //get
   pages into a drop-down list $pages_list = get_pages(); $getpag = array(); foreach(
   $pages_list as $page) { $getpag[$apage->ID] = $apage->post_title; } $page_dropdown
   = array_unshift($getpag, “Select a page:”);` Here is the error: `Catchable fatal
   error: Object of class stdClass could not be converted to string in C:\wamp\www\
   wordpress\wp-includes\classes.php on line 273` Here is the area of the classes.
   php file targeted in the error.
 *     ```
       for ($i=0; $i<count($this->public_query_vars); $i += 1) {
       			$wpvar = $this->public_query_vars[$i];
       			if (isset($this->extra_query_vars[$wpvar]))
       				$this->query_vars[$wpvar] = $this->extra_query_vars[$wpvar];
       			elseif (isset($GLOBALS[$wpvar]))
       				$this->query_vars[$wpvar] = $GLOBALS[$wpvar];
       			elseif (!empty($_POST[$wpvar]))
       				$this->query_vars[$wpvar] = $_POST[$wpvar];
       			elseif (!empty($_GET[$wpvar]))
       				$this->query_vars[$wpvar] = $_GET[$wpvar];
       			elseif (!empty($perma_query_vars[$wpvar]))
       				$this->query_vars[$wpvar] = $perma_query_vars[$wpvar];
   
       			if ( !empty( $this->query_vars[$wpvar] ) ) {
       				$this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar];
       				if ( in_array( $wpvar, $taxonomy_query_vars ) ) {
       					$this->query_vars['taxonomy'] = $taxonomy_query_vars[$wpvar];
       					$this->query_vars['term'] = $this->query_vars[$wpvar];
       				}
       			}
       		}
       ```
   
 * The code specified in line 273 is
    `$this->query_vars[$wpvar] = (string) $this-
   >query_vars[$wpvar];` This may be directly related to PHP or maybe a bug in the
   new WordPress release. Any thoughts would be appreciated.

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

 *  Thread Starter [tsalagi](https://wordpress.org/support/users/tsalagi/)
 * (@tsalagi)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/template-tutorial-error/#post-1290120)
 * I’ve resolved this issue by finding an error in my own code. “apage” duh
 *  [termserv](https://wordpress.org/support/users/termserv/)
 * (@termserv)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/template-tutorial-error/#post-1290326)
 * What did you do to fix it?
 *  [termserv](https://wordpress.org/support/users/termserv/)
 * (@termserv)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/template-tutorial-error/#post-1290337)
 * Never mind. Found my problem: You cant use `$page` or `$post` as variable, as
   they are used for holding the pages and posts as objects.

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

The topic ‘Template Tutorial – Error’ is closed to new replies.

## Tags

 * [Catchable fatal error](https://wordpress.org/support/topic-tag/catchable-fatal-error/)
 * [classes.php](https://wordpress.org/support/topic-tag/classes-php/)

 * 3 replies
 * 2 participants
 * Last reply from: [termserv](https://wordpress.org/support/users/termserv/)
 * Last activity: [16 years, 6 months ago](https://wordpress.org/support/topic/template-tutorial-error/#post-1290337)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
