Community Forums › Forums › Archived Forums › General Discussion › Page template with custom loop not displaying WordPress GUI content
Tagged: advanced custom fields, custom loop, page template
- This topic has 1 reply, 2 voices, and was last updated 10 years, 8 months ago by Susan.
-
AuthorPosts
-
November 20, 2013 at 4:11 pm #74581sugarfiend06Member
New to PHP, WordPress, and Genesis, so it's really likely I might be missing something super-basic here. I'm using the Genesis framework only, making my own child theme. (Yeah, I know I'm overly ambitious/insane.)
I want to be able to display content from the WordPress GUI (not a custom field) before the loop on a page template that also displays custom fields from the Advanced Custom Fields plugin. Basically, I want the page content to be intro text. I've been trying both the_content(); and get_the_content(); functions but it doesn't seem that either one is working.
I know I've gotten the HTML and PHP syntax right, since the tags do show up and the title appears correctly - there's just nothing between the <p> tags. I'm not sure what else to try, since everything I've Googled says that either get_the_content(); or the_content(); should work.
This is the entire page template:
http://caremaestro.anitacheng.com/programsoverview/<?php /** * Template Name: Programs overview * Description: Used as a page template to show page contents, followed by a loop through a CPT archive */ remove_action( 'genesis_post_content', 'genesis_do_post_content' ); remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop add_action ( 'genesis_loop', 'cm_programs_custom_loop' ); // Add custom loop function cm_programs_custom_loop() { ?> <h1><?php echo get_the_title(); ?></h1> <div class="overview"> <p><?php echo get_the_content(); ?></p> </div> <? $args = array( 'post_type' => 'programs', // enter your custom post type 'order' => 'ASC', 'posts_per_page'=> '5', // overrides posts per page in theme settings ); $loop = new WP_Query( $args ); if( $loop->have_posts() ): while( $loop->have_posts() ): $loop->the_post(); global $post; echo '<div class="programlist">'; echo '<h3>'.get_the_title ().'</h3>'; echo '<p>'; the_field( 'short_descriptive_headline' ); echo '</p>'; echo '</div>'; endwhile; endif; } /** Remove Post Info */ remove_action('genesis_before_post_content','genesis_post_info'); remove_action('genesis_after_post_content','genesis_post_meta'); genesis();
February 12, 2014 at 7:34 pm #90072SusanModeratorSince it's been a while since you posted your question, I hope you got your issue resolved.
If not, please report back to me, and I will escalate to try to get someone to assist you.
Thanks!
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.