Get title and excerpt from page (about) and display on static page (home)
-
Hi everyone,
New to wordpress so please excuse if I am making something simple very complicated.
I am using wordpress to create a more traditional web site with navigation tabs: home, about, blog and contact.
The home page is set as my static page. The about and contact pages are just set as standard page and the blog page contains my posts.
I am trying to get the home page to display the titles and excerpts of the about and blog page on the home page. I have used the following code:
<?php
$page_id = 2;
$page_data = get_page( $page_id );
$content = $page_data->post_content;
$title = $page_data->post_title;
echo $page_data->post_content;
?>The page id of my contact page is 2. I have managed to get the excerpt of the page displaying but have had no luck with the title getting pulled through.
Is this even possible? Thank you very much in advance.
Phil Vale
- The topic ‘Get title and excerpt from page (about) and display on static page (home)’ is closed to new replies.