Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've created a custom template for my "About Us" page because it need more options than what the static "page.php" file had to offer.

However the content that i enter into my "About Us" page from the default WYSIWYG editor on the back end doesn't appear on the new template obviously because i'm not calling in that template part (if that's even the right term for it).

Just to be clear when i create a custom template and need to call in a custom Field Group i'm using

<?php get_template_part( 'content', 'content_area' ); ?>

However i will state that on this template page i'm not using a loop in this particular php file, is that not ok. Do loops need to be part of all php pages? Maybe i should start there.

Here's my code

/*
Template Name: About Us
*/

include(TEMPLATEPATH."/header-internal.php");


<div class="container-space"></div>

<div class="container-main">

  some content goes here

<div class="divider-btm"></div>

<?php get_template_part( 'content', 'content_area' ); ?>

</div>



<!--Update Solution Attempt-->

 <?php
 $args = array(
  ' post_type' => 'content_area'
 );
 $the_query = new WP_Query( $args );
 ?>

 <?php if( $the_query->have_posts() ) : while( $the_query->have_posts() :
 $the_query->have_posts(); ) ?>

 <h3><?php the_field( 'header' ); ?></h3>
 <p class="desc"><?php the_field( 'content_area' ); ?></p>

 <?php endwhile; endif; ?>
share|improve this question
    
I don't get the blockquote feature here, when i use it doesn't present my code as is but rather cuts out some of it so i try to just paste it without using it and it still won't show up right. I haven't been able to figure it out yet unfortunately and it's hurting my potential to get good answers back as a result. Not sure what's up? –  MARS Sep 20 '13 at 14:42
1  
what is in the file content-content_area.php you're calling via get_template_part? –  Milo Sep 20 '13 at 14:54
    
What you write in the WYSIWYG editor is normally printed via the_content function, but this works inside the loop, however for single page template, you can simply use the_post(); immediately after included the header and then the_content(); in your content-content_area.php. A tip: you can use get_header('internal'); to include your header. –  G. M. Sep 20 '13 at 16:05
    
@Milo I think i mixed concepts up. The "get_template_part" was calling "content_area.php" but there is no "content_area.php" I was actually trying to call a content post type in which case i believe i should've created a custom $query = new WP_Query( $args ) with an array parameter of " 'post_type' => 'content_area' " that would require a loop. So i was mixing concepts completely. Your advice on other posts though have been golden, that one nugget of understanding that $the_query is a custom variable opened up a world of understanding. –  MARS Sep 20 '13 at 19:07
    
@G.M. awesome tip on the get_header() that works beautifully and is way easier to remember. I'm going to try your suggestion as well and am about to post the latest attempt prior to trying out your solution which crashed my 'About' page. –  MARS Sep 20 '13 at 19:09
show 6 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.