Display Page Excerpt Before WordPress Loop
-
Hello Fellow WordPress Lovers
I want to use one of my pages as an introduction before my WordPress Loop on the index.php home page. (My settings have the blog feed as my home page).
I put this above my Loop:
$page_id = 95; $page_data = get_page( $page_id ); echo apply_filters('the_content', $page_data->post_content);
It works great, but it shows the entire article. Is there a way to show only the content of that page above the “read more” tag, along with a “read more” link?
By the way I tried this with no luck:
echo apply_filters('the_excerpt', $page_data->post_excerpt);
I also tried this with no luck:
$page_id = 95; // substitute to your page id $my_page = get_page($page_id); echo "<p>$my_page->post_excerpt</p>"; echo '<a href="'.get_permalink( $page_id ).'">read more</a>';
Is this a situation for a multiple loop? Those confuse me so I would love to get some help from an experienced WP user. Thank you!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Display Page Excerpt Before WordPress Loop’ is closed to new replies.