Skip to content

Instantly share code, notes, and snippets.

@besimhu
Created March 15, 2015 16:03
Show Gist options
  • Save besimhu/cac5dba8828ae52de98b to your computer and use it in GitHub Desktop.
Save besimhu/cac5dba8828ae52de98b to your computer and use it in GitHub Desktop.
Say you want to pull content from one page to a template or another page. Well this function is for you! You can also change get_page_by_path to get_page_by_id and utilize an id instead.
// Pull content from another page
function show_post($path) {
$post = get_page_by_path($path);
$content = apply_filters('the_content', $post->post_content);
echo $content;
}
// To use
<?php show_post('about'); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment