Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Trouble with page content displaying on the same page as posts..

Hi everyone!

I am making a theme for a client and I am having a little trouble getting page content entered in the admin side to display at the top of my page.

This is to be the blog page and I would like them to be able to add there own content for the page at the top and then followed my the blog posts.

The code below might help to explain the situation!

<?php get_header(); ?>

    <div class="container">        
        <div class="grid__col--12">
            <h1 class="page-header">
                <?php wp_title(""); ?>
            <p class="page-content">
                <!-- Wanting Page Contnet to go here! -->

    <div class="container">
        <div class="grid__col--8">

            <div class="post-wrap">
                    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                <div class="post container">

                    <div class="grid__col--9">
                        <h1 class="post-header">
                            <a href="<?php the_permalink(); ?>">
                                <?php the_title(); ?>

                        <p class="post-date">
                            <?php the_time( 'F j, Y' ); ?>

                        <hr class="post-hr">

                        <p class="post-lead">
                            <?php echo strip_tags( get_the_excerpt() ); ?>

                        <?php the_category(' '); ?>

                    <div class="grid__col--3 hide-mobile">
                        <?php if( get_the_post_thumbnail() ): ?>
                        <div class="post-img border-radius hide-mobile">
                            <?php the_post_thumbnail( 'thumbnail' ); ?>
                        <?php endif; ?>


                <?php endwhile; else : ?>

                    <p><?php _e( 'Sorry, no pages found.' ); ?></p>

                <?php endif; ?>

        <?php get_sidebar( 'blog' ); ?>


<?php get_footer(); ?>

Hope you can help people!


1 Answer

Raymon Oleaga
Raymon Oleaga
19,298 Points

Why don't you register a widget area that displays in that area with the conditional

 if ( is_home() ) {
  // blog page

and add a text widget.....

Hope this helps trigger a solution!