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.
- The topic ‘Template Tutorial – Error’ is closed to new replies.