How to add post content to a page
-
I’m having a bit of a hard time displaying the post content on a page. I don’t know what else to add — when I use the following code my post content doesn’t display.
<?php get_header(); ?> <div id="PageContent"> <div class="general_column_text" id="Column1"> <div class="sectionHeader"><img src="images/home/from_the_trail.jpg" alt="From The Campaign Trail" /></div> <div class="title"><a href="<?php the_permalink() ?>" title="<?php _e('Permanent Link to', 'default'); ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></div> <div class="description"> <?php $content = get_the_content(); ?> </div> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
But, when I use this code, my text is indented, throwing off all of my text and ruining my layout.
<?php $lastposts = get_posts('numberposts=3'); foreach($lastposts as $post) : setup_postdata($post); ?> <h2><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a></h2> <?php the_content(); ?> <?php endforeach; ?>
Does anyone know what to do? Any help would be much appreciated!! ??
Richard
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to add post content to a page’ is closed to new replies.