wordpress - Loop through array of objects (PHP) -


i have been trying loop through array cannot retrieve post title. little missing can't right.

array ( [0] => wp_post object     (         [id] => 5366         [post_author] => 1         [post_date] => 2013-07-09 12:06:00         [post_date_gmt] => 2013-07-09 12:06:00         [post_content] =>          [post_title] => mini face lift         [post_excerpt] =>          [post_status] => publish         [comment_status] => open         [ping_status] => open         [post_password] =>          [post_name] => mini-face-lift         [to_ping] =>          [pinged] =>          [post_modified] => 2013-07-09 12:06:00         [post_modified_gmt] => 2013-07-09 12:06:00         [post_content_filtered] =>          [post_parent] => 17     )     ) 

if want post title -- how do it? i'd appreciate stuck.

huge in advance!

it's not multi-dimensional array, array of objects . . . try like:

$varname[0]->post_title

alternatively:

$varname[0]['post_title']

if you're trying iterate , each title, want like:

foreach ($varname $key=>$wppostobject) {     echo $wppostobject->post_title; } 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -