Created
June 9, 2013 20:11
-
-
Save xafarali/5745007 to your computer and use it in GitHub Desktop.
Post the page content in template via page id or slug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$pageID = 'page name or slug'; | |
get_ID_by_slug($pageID ); | |
// page id by slug | |
function get_ID_by_slug($page_slug) { | |
$page = get_page_by_path($page_slug); | |
if ($page) { | |
return $page->ID; | |
} else { | |
return null; | |
} | |
}; | |
// Post Page Content | |
function post_page_content($page_slug) { | |
get_ID_by_slug($page_slug ); | |
$id = get_ID_by_slug($page_slug ); | |
$post = get_page($id); | |
$content = apply_filters('the_content', $post->post_content); | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment