Title: Include Page Content without Loop
Last modified: August 20, 2016

---

# Include Page Content without Loop

 *  Resolved [mc_marie](https://wordpress.org/support/users/mc_marie/)
 * (@mc_marie)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/include-page-content-without-loop/)
 * So I’ve been using the code posted here: [http://wordpress.org/support/topic/use-text-from-my-word-press-page-elsewhere-on-my-website?](http://wordpress.org/support/topic/use-text-from-my-word-press-page-elsewhere-on-my-website?)
 * However, it doesn’t work if the page desired is anything other than a main page.
 * Does anyone have a similar trick that I could use for displaying sub-page (or
   sub-sub page) content without using the loop?

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * (@justingreerbbi)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/include-page-content-without-loop/#post-3209902)
 * Why would you not want to use the loop. It has everything you need and is not
   bloated?
 *  [wpismypuppet](https://wordpress.org/support/users/wordpressismypuppet/)
 * (@wordpressismypuppet)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/include-page-content-without-loop/#post-3209904)
 * Can you give a more details on what you are trying to accomplish? Where are you
   using that code? Do you have one static page that is pulling content from your
   WordPress site? Are you using multiple pages? Can you send a link to your existing
   site where the problem resides? Can you maybe show some code?
 * I believe I can help you with this, but right now it’s too vague for me to know
   where to begin.
 *  Thread Starter [mc_marie](https://wordpress.org/support/users/mc_marie/)
 * (@mc_marie)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/include-page-content-without-loop/#post-3209918)
 * We are displaying the page content on an archive page in a specific section. 
   You can see it working [here](http://mumf.org/category/church-resources/) on 
   a category-ID.php while the page of desired content is at the main level. However,
   for several reasons, we want the page of desired content to be a sub-page of 
   Churchs & Organizations.
 * I have also used this code in other ways when I’m trying to display page content
   in another page template or something of that sort.
 *     ```
       <?php //including text from a page without using the loop! without loop outside of loop page content
       		//http://wordpress.org/support/topic/use-text-from-my-word-press-page-elsewhere-on-my-website
       		include "wp-load.php";
       		$page = get_page_by_path('church-resources'); //slug of desired page
       		echo apply_filters('the_content', $page->post_content);?>
       ```
   
 *  [wpismypuppet](https://wordpress.org/support/users/wordpressismypuppet/)
 * (@wordpressismypuppet)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/include-page-content-without-loop/#post-3209925)
 * That code you are using should work completely fine anywhere on your website.
   What might not be working is your include statement. Are you getting any error
   messages when doing this? Also, if a page you are using is already a part of 
   WordPress… ie inside your theme’s folder… you don’t need to include wp-load.php.
   this is only if you are physically outside of the WordPress directory.
 *  Thread Starter [mc_marie](https://wordpress.org/support/users/mc_marie/)
 * (@mc_marie)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/include-page-content-without-loop/#post-3209928)
 * So it’s true that I don’t need the include statement, but I still can’t use this
   code unless the page is a main level page.
    Thoughts on why this could be working
   this way?
 *  [wpismypuppet](https://wordpress.org/support/users/wordpressismypuppet/)
 * (@wordpressismypuppet)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/include-page-content-without-loop/#post-3209929)
 * No, you can… you just need to include the path to the child page. Let’s say “
   church-resources” is a child page of “about-us”… then you would write:
 *     ```
       <?php
       	$page = get_page_by_path('about-us/church-resources');
       	echo apply_filters('the_content', $page->post_content);
       ?>
       ```
   
 *  Thread Starter [mc_marie](https://wordpress.org/support/users/mc_marie/)
 * (@mc_marie)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/include-page-content-without-loop/#post-3209932)
 * tried that – didn’t work.
    (just tried again) and it works. I must have had my
   parent page slug wrong the first time!
 * Thanks for all of your help!
 *  [wpismypuppet](https://wordpress.org/support/users/wordpressismypuppet/)
 * (@wordpressismypuppet)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/include-page-content-without-loop/#post-3209933)
 * You are welcome… it could have also been the include statement causing a PHP 
   error, which then caused the rest of the code to fail as well. Glad I could assist!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Include Page Content without Loop’ is closed to new replies.

## Tags

 * [display content](https://wordpress.org/support/topic-tag/display-content/)
 * [main page](https://wordpress.org/support/topic-tag/main-page/)
 * [no loop](https://wordpress.org/support/topic-tag/no-loop/)
 * [sub-page](https://wordpress.org/support/topic-tag/sub-page/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 3 participants
 * Last reply from: [wpismypuppet](https://wordpress.org/support/users/wordpressismypuppet/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/include-page-content-without-loop/#post-3209933)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
