Category posts don’t show like frontpage
-
Hello, first of all I’m sorry if this question was answered before.
I have a blog and when i access a certain category ( http://www.blog.com/category/mysamplecat ) i can see only the NAME of the posts that are allocated in that category, without the content of those posts ( exactly as it show on the front page, if i want to see the content of a post that is in the mysamplecat category i have to access that post ). How can i fix this problem, so when i access a certain category i can see the posts exactly as i see them on the main page of the blog.
Take me slow, I’m new to WordPress.
-
Duplicate your theme’s template file index.php and rename it to category.php . Now your category pages will show exactly as your front page.
I have no category.php file in my theme. What you suggested was my first try.
Hello, I just posted a similar problem I’m having. I want the “entire” layout of a “particular” category to mimic the layout of the “home/index” page.
I think what Keesiemeijer meant was for you to duplicate the index.php page, rename it, but then save it to the wp-admin folder…not the theme’s folder. But if you did that, that would override critical functions calls for your categories…so actually it doesn’t sound like that would work…
If your theme has no category.php you can duplicate the index.php and rename it to category.php. You put this file in your theme folder and not in wp-admin folder. does your front page show all the content? Or do you have a static front page?
Ok, I see now you don’t show content on the front page. Put this somewhere inside the loop of your newly created category.php
<?php the_content('Read the rest of this entry »'); ?>
example of loop:<?php if (have_posts()) : ?> <!-- loop starts here --> <?php while (have_posts()) : the_post(); ?> <!-- do stuff ... --> <?php the_content('Read the rest of this entry »'); ?> <?php endwhile; ?><!-- loop ends here --> <?php endif; ?>Alright…now I’m getting somewhere…
Your suggestion to rename whatever .php layout I want to “category.php” changes any page listed in the category admin panel to just that new category layout.
Now, I want only a “specific” category to changed in the admin panel. So its sounds like a need to have a conditional statement that looks for a category name and “if” this name exists “include” whatever.php correct?
this question is for keesiemeijer…or whoever else knows the answer..
You can use is_category() to customize the category.php.
<?php if (is_category('9')) : ?> <!-- do stuff --> <p>this is category 9</p> <?php endif; ?>You can also rename the duplicate index.php (category.php) to category-{slug}.php – If the category’s slug were news, WordPress would look for category-news.php. look here (Template Hierarchy) for more info
Got it…thanks a lot…
what I used was:
<?php if ( is_category('backdoor_home') ) { include( ABSPATH . 'wp-content/themes/one-theme/layouts/backdoor-layout.php' ); } else { include( ABSPATH . 'wp-content/themes/one-theme/layouts/blog-layout.php' ); } ?>..as it relates to how this thing is developer of course..
hello,
thanks for all this really helpful info.
i duplicated a file called page_blog.php and renamed it category-slug-name.php as i didn’t have a category.php file in my theme.
i have two menu links which link to cat5 (which i created the custom category page for) and cat4.
after duplicating the file when clicking on cat5’s menu link, the contents of cat4 is displayed.
i don’t know why this is happening.
the only thing i can see in the new category-slug-name.php file that calls the posts is:
<?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=" .ot_option('blog_cat'). "&showposts=" .ot_option('blog_cat_num'). "&paged=$paged"); while ( have_posts() ) : the_post() ?>is there anything in this code which would make the page only show the contents of cat4 (even though the menu item links to cat5)?
thanks!
Please help me 😮 I am having the same problem, I’ve managed to duplicate index.php to category.php which has made my category pages exactly the same as my front page (which I use for latest posts), but how do I keep the category pages still listing posts for that category? Basically I just want to same layout as the front page for my category page.
Below is my category.php code, which bit to I need to change or add to make the posts just from the relevant category?
<?php get_header(); ?> <?php $my_query = new WP_Query('showposts=1'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <div class="top_post" id="post-<?php the_ID(); ?>"> <div class="post_title"> <h2> <div class="headline"> LATEST BLOGS </div> <div class="headline_date"> <?php the_time('F jS, Y') ?> </div> </h2> </div> <div class="top_entry"> <div class="top_titles"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a> </div> <?php the_content('Read the rest of this entry »'); ?> </div> <div class="post_bottom"> <div class="post_cat"> </div> </div> </div> <?php endwhile; ?> <?php rewind_posts(); ?> <div id="about_box2"> <img src="http://pugwashmagazine.com/wp-content/uploads/jen.jpg" width="70"/> <h3> WRITE FOR US </h3> <?php include (TEMPLATEPATH . '/about2.txt'); ?> </div> <div id="content"> <?php query_posts('showposts=10&offset=1'); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="mag_posts" id="post-<?php the_ID(); ?>"> <div class="top_mag_posts"> <div class="bottom_mag_posts"> <h2><?php the_category(', ') ?></h2> <div class="mag_posts_entry"> <div class="top_mag_titles"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a> </div> <?php the_content(); ?> </div> <div class="mag_posts_meta"> <div class="meta_date"><?php the_time('j') ?> <?php the_time('F') ?> <?php the_time('Y') ?></div> <div class="meta_comments"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">Read More >></a></div> </div> </div></div></div> <?php endwhile; ?> <?php endif; ?> </div> <?php include (TEMPLATEPATH . '/rightads.php'); ?> <?php get_sidebar(); ?> <div class="clear"></div> <?php get_footer(); ?>
The topic ‘Category posts don’t show like frontpage’ is closed to new replies.