Creating an excerpt for specific page in footer
-
Hi everyone, I have trawled the support forums for an answer to my problem but can’t find a solution. I am new to php so please bear with me.
For the site I am developing, I want the footer to contain the excerpt (first 55 words etc) of my static ABOUT page. I have tried so many different methods, but the best I can do is to get the excerpt pulled from the page that the footer is currently sitting on (it doesn’t appear to pick up the page ID). Below is my code:
<?php $page_id = 6; $page_data = get_page( $page_id ); $content = $page_data->the_excerpt; $title = $page_data->post_title; echo '<h3>'. $page_data->post_title .'</h3>'; echo the_excerpt( $page_id ); ?>
Now this code works, but it pulls out the entire text of my ABOUT page and not just the excerpt:
<?php $page_id = 6; $page_data = get_page( $page_id ); $content = $page_data->post_content; $title = $page_data->post_title; echo '<h3>'. $page_data->post_title .'</h3>'; echo $content; ?>
Here is a link to the site, code currently in place is the first I quoted; as you can see it pulls the excerpts from the current page it’s on, and not the page ID I specified. Kini Girl WP
- The topic ‘Creating an excerpt for specific page in footer’ is closed to new replies.