0

I am new in Wordpress ... I developed a theme and I want to display the contents of a specific item ID in a div.

For example...I create this div.

<div id="myarticle">

//function php WORDPRESS

</div>

What is the php function that helps me to display the content of an article?

Thanks in advance!

1

If you only want The Content (of the main editor of the post) displayed, you can use echo get_the_content(the_ID). If you want more:

  1. First, you have to get the post data from the database, with the function get_post, or doing a query with WP_query.

  2. Then you can output different parts like title, date, content... accessing your variable properties, or doing a Loop, depending on what method you use.

I recommend you to examine other themes code to understand how it works, and of course The Codex, that is the WordPress documentation. The basics are very easy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.