0

Hello friends, I have a small problem with getting the content from the pages in WordPress.
In my admin panel I have created some pages, also I have created a custom template and now when I want to open any of the pages then the content is not displayed (the content is empty). Only "Hello World" page works great (FrontPage or ?p=1), but the other pages (?p=4, ?p=6...) in admin panel have a content, but when I try to open in my website then the pages are without content (the content is empty).

For getting the content I use this function:

<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
   global $post;
   echo nl2br($post->post_content);
   // I tried with the_gontent() but I got the same problem.
?>				
<?php endwhile; ?>
<?php endif; ?>

How can I solve this problem ?

Thanks.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by wpmonster
0

create single.php file on theme folder. and use this code:

<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<?php the_content('devamını oku &raquo;'); ?>
<?php endwhile; endif; ?>

If everything is ok, that means your post variable is empty. If not, you may change your static page. Control your settings from: http://www.yoursite.com/wp-admin/options-reading.php

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.