Answers for "Get page title, excerpt or content by Name of the Page"

PHP
0

Get page title, excerpt or content by Name of the Page

<?php 
$page_name = get_page_by_title( 'About' ); // here About is page name.


echo $page_title = $page_name->post_title;

echo $page_excerpt = $page_name->post_excerpt;

echo $page_content = $page_name->post_content;
?>
Posted by: Guest on May-13-2021
0

Get page title, excerpt or content by id

<?php 
$var_name = get_post('1'); // here 1 is id of the page.

echo $page_title = $var_name->post_title;

echo $page_excerpt = $var_name->post_excerpt;

echo $page_content = $var_name->post_content;
?>
Posted by: Guest on May-13-2021

Code answers related to "Get page title, excerpt or content by Name of the Page"

Browse Popular Code Answers by Language