简体   繁体   中英

Using post-content returns '0'

When I'm trying to utilise the post functions of Wordpress on another page, something odd happens.

I'm attempting to grab a specific post using the predefined ID of the Wordpress post and the title, content and date within it using the code as follows:

$post = get_post( $_GET['p'] );
echo "<hr><h1>" . $post->post_title . "<br /></h1>";
echo apply_filters( 'the_content', $post->post-content ) . "<br /><br />";
echo "Published on: " . $post->post_date;

However this produces the following output:

字按

When the 0 should be replaced by a lot of lopus ipsum text.

I've had a look around the Wordpress support sites and Google to no avail, any ideas on how to fix this would be much appreciated.

它的post_content不是post-content :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM