Ecommerce

How to get post title in wordpress?

  1. Create the object of get_post.
  2. Output the title by calling the post_title variable.

Likewise, how do I get post title and content in WordPress? $post_7 = get_post( 7 ); echo $post_7->post_title; To get the post content for a post with ID 7: $post_7 = get_post( 7 ); echo $post_7->post_content; Let me know if this helped.

Also, which function get the title of the page or post? You can use the function get_the_title() to get the title of a page as a variable just by providing the ID. If you don’t provide an ID, then the function will try to fetch the ID for the current page.

See also  What are woocommerce endpoints?

Related Articles

Back to top button