Displaying Blog Post on a Static Page?
-
Hello there!
I am trying to use WordPress as a content management system. So I’m looking for a way to display recent updates (from my update category) on a static homepage. I’ve seen some codes on here that are suppsoed to do this, however I’m not sure how they work. Basically, they tell you to call the category with php and then insert your post loop in between them. Like this:
<?php $my_query = "showposts=3&cat=5"; $my_query = new WP_Query($my_query); ?>
<?php if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); ?><div class="post">
<h2> " title="<?php the_title(); ?>"> <?php the_title(); ?> </h2></div>
<div class="entry">
<?php the_content(); ?>
<p class="postmetadata"><?php _e('Filed under:'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php the_author(); ?>
<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <?php edit_post_link('Edit', ' | ', ''); ?></p>
</div><?php endwhile; // end of one post ?>
<?php endif; //end of loop ?>
</p>Well all I'm getting is a display of a piece of PHP code and my title header images repeated twice! I am doing this by editing the page I set as the home page in the wordpress dash bored. Am I supposed to edit my index instead? Page file? Basically either I'm doing something wrong or I'm using the wrong code. D:
If someone could answer my questions I'd be very grateful! Also, if you need to see my skin or something I'll provide that if you absolutely need it. I'm trying to keep the whole site secret until I finish everything.
Thanks!
- The topic ‘Displaying Blog Post on a Static Page?’ is closed to new replies.