error while loading wordpress post using ID

I am trying to retrieve the content of a wordpress post using its ID:

$loadpost = url_to_postid($actual_link); 
$newpost = get_post($loadpost);
echo '<article id="post-'.$newpost["ID"].'"><h1>'.$newpost["post_title"].'</h1>'.$newpost["post_content"];

$loadpost returns a valid ID but somehow this expression does not work. IE returns:

Fatal error: Cannot use object of type stdClass as array in /hermes/waloraweb046/b428/moo.snippetspacecom/splittemplate/wp-content/themes/split/index.php on line 24

What does this mean?

Thanks for your help guys.

Answers


Because get_post(); by default outputs as an OBJECT

What you want to return is

echo '<article id="post-'.$newpost->ID.'"><h1>'.$newpost->post_title.'</h1>'.$newpost->post_content;

Need Your Help

Java - redraw background

java graphics awt

I want to redraw background with different image. Here's a SSCCE example - I'd like to add an action to Listener that will repaint with another image.

detect change in Flex Form elements (textinput, textarea, combobox, checkbox..)

flex actionscript-3 events actionscript flex3

I have various (read lots of..) flex forms in my app, and I now want to create a system by which the user is notified that he hasn't saved if he modifies anything in the form...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.