Created
March 15, 2015 16:03
-
-
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.
This file contains hidden or 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
// 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