WordPress.org

Ready to get started?Download WordPress

Forums

Content won't display on custom page template (12 posts)

  1. styletheology
    Member
    Posted 2 years ago #

    I recently created a blank page template to use for static pages, however,now whenever I enter text into the content area for the page in my dashboard it doesn't show up.

    Here is the copy of my template code.

    <?php
    /*
    Template Name: Blank Page 2
    */
    
    define('WP_USE_THEMES', false);
    require('wp-blog-header.php');
    get_header();
    get_sidebar();
    get_footer();
    ?>

    Here is the link to the page I am using:

    http://www.styletheology.com/?page_id=61&preview=true&preview_id=61&preview_nonce=9b1b6dd5fa

    It should say "This is a test"

    Please help. Thanks in advance

  2. Pali Madra
    Member
    Posted 2 years ago #

    He Styletheology

    Have you published the post as I get an error that reads "You do not have permission to preview drafts." when I click on the link you shared. I think you are talking about http://www.styletheology.com/?page_id=61. Please confirm if this is correct.

  3. styletheology
    Member
    Posted 2 years ago #

    Yes, the page that I used to test the text was:

    http://www.styletheology.com/?page_id=61

  4. datdesignguy
    Member
    Posted 2 years ago #

    Hi styletheology,

    The problem is with your template code itself. You are forgetting to call the_content(). If you add a call to the_content(); into your template you should see the content of your page. Simple fix :-)

    Hope this helps,

    -Greg J

  5. styletheology
    Member
    Posted 2 years ago #

    I added the line to the template code, but it still isn't working:

    <?php
    /*
    Template Name: Blank Page 2
    */
    
    define('WP_USE_THEMES', false);
    require('wp-blog-header.php');
    get_header();
    get_sidebar();
    get_footer();
    
    the_content();
    
    ?>

    Am I missing something?

  6. datdesignguy
    Member
    Posted 2 years ago #

    You will probably want to move the call to the_content(); so that it is situated between get_header(); and get_sidebar();

  7. JarretC
    Member
    Posted 2 years ago #

    You also need to include the loop to make sure you have posts - http://codex.wordpress.org/The_Loop

    <?php if ( have_posts() ) : while( have_posts() ) : the_post();
         the_content();
    endwhile; endif; ?>
  8. datdesignguy
    Member
    Posted 2 years ago #

    ahhh, yes, I actually had this problem just yesterday when working on a custom home page template. NEVER forget the loops! gj Jarret

  9. styletheology
    Member
    Posted 2 years ago #

    Thanks, I got it to work now.

    Now if I could just figure out how to change the sidebar area from grey to white. I have gone through my style.css code backwards and forwards and I can't figure it out. I have changed every sidebar background color to #ffffff, but it doesn't change anything. Any ideas?

  10. JarretC
    Member
    Posted 2 years ago #

    There are 2 #container sections in your CSS.

    In each section, change

    background: url(images/bg-container.png) repeat-y;

    to

    background: #fff;

  11. styletheology
    Member
    Posted 2 years ago #

    Thank you, I finally got it working right for the colors. I noticed though that if I view the site on an ipad the content from the post area bleeds over into the side bar. Any ideas?

  12. datdesignguy
    Member
    Posted 2 years ago #

    You'll need to read up on CSS Media Queries for that bit. It can be a bit hairy.

    Also I recommend reading up on Responsive Design.

Topic Closed

This topic has been closed to new replies.

About this Topic