Wordpress feature box for page content with read more link query
I'm using the below code to pull content successfully from a page with
specific id of 123. However, when I try to use the read more tag in the
admin area for the page content, it does not seem to affect how the code
is pulling the content as it still retrieves the full amount of content.
Any ideas what I am doing wrong here?
<?php
$page_id = 123; // 123 should be replaced with a
specific Page's id from your site, which you can find
by mousing over the link to edit that Page on the
Manage Pages admin page. The id will be embedded in
the query string of the URL, e.g.
page.php?action=edit&post=123.
$page_data = get_page( $page_id ); // You must pass in
a variable to the get_page function. If you pass in a
value (e.g. get_page ( 123 ); ), WordPress will
generate an error. By default, this will return an
object.
echo apply_filters('the_content',
$page_data->post_content); // echo the content and
retain Wordpress filters such as paragraph tags.
?>
No comments:
Post a Comment