Page template with custom loop not displaying WordPress GUI content

Community Forums Forums General Discussion Page template with custom loop not displaying WordPress GUI content

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  Susan 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #74581

    sugarfiend06
    Member

    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:

    <?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();
    http://caremaestro.anitacheng.com/programsoverview/
    #90072

    Susan
    Moderator
    Post count: 7369

    Since 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!


    Susan @ Graphically Designing I’d love to customize your website! I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.