How to pull the content of a page from the current ID
-
Hi,
I have a template I am using called General Content, which will be used for all other pages except for the home page.
I am trying to pull the content of the pages into this template of that specific page. Here’s what I have tried.
- Basing my template page on page.php
- Various forms of The Loop
- And eventually this option…
<div class="layout"> <?php $page_id = 26; $page_data = get_page( $page_id ); echo '<h3>'. $page_data->post_title .'</h3>'; echo apply_filters('the_content', $page_data->post_content); ?> </div>
This works based on the example from the codex but what I would like is is to set a the page_id to the current page
Something like this:
$page_id = $page->ID;
Many thanks
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘How to pull the content of a page from the current ID’ is closed to new replies.