WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Formatting Problems With Page For Category (4 posts)

  1. ibillett
    Member
    Posted 1 year ago #

    Hello fellow wordpress users, I hope somebody can help me a small problem I am having with formatting on a page.

    Basically I created to display all of the posts in a certain category and I have done this successfully. However the problem is that I cannot figure out how to format the posts on the page like the home page.

    Homepage

    Category Page

    The following is the code from the category page...

    <?php
    /**
     *Template Name: PageOfPosts
     */
    ?>
    <?php get_header(); ?>
    <?php get_sidebar(); ?> 
    
    <?php $page_query = new WP_Query('post_type=post&cat=3'); ?>
    <?php while ($page_query->have_posts()) : $page_query->the_post(); ?>
    <a>" rel="bookmark"><?php the_title(); ?></a>
    <?php the_content('Read the rest of this entry ยป'); ?>
    <?php endwhile; ?>
    
    <?php get_footer(); ?>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    My coding/html knowledge is pretty limited so it's probably something pretty simple and easy.

    Thanks in advance for your help!

  2. semblance_er
    Member
    Posted 1 year ago #

    Can you explain a bit more of how you would like the posts to be formatted on the home page? Or do you only want specific posts to show on the home page?

  3. alchymyth
    Forum Moderator
    Posted 1 year ago #

    the html structure of a page template should usually mirror the structure of the other templates of the theme;
    your example has no html tags at all.

    as you are using Twenty Eleven, look here http://codex.wordpress.org/Pages#A_Page_of_Posts

    is there any reason why you don't work with the genuine category template category.php, or a custom category template, in your case category-3.php ?
    http://codex.wordpress.org/Category_Templates

  4. ibillett
    Member
    Posted 1 year ago #

    Sorted! I have used the template from the A_Page_of_Posts, which is what I should have done in the first place. Thanks for the suggestions!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.