You Might try this, alot of people have gotten it to work but unfortunatly I can not, But it seems to be what you may be looking for.
http://www.mihaivalentin.com/wordpress-tutorial-load-the-template-you-want-with-template_redirect/
That’s not what I’m look for.
I’m looking for the loop that only shows the post of that category that is chosen, nothing to do with template definitions.
I’m looking for the loop that only shows the post of that category that is chosen, nothing to do with template definitions.
WordPress does this automatically. For example, for category foobar
, the following URL will display all posts with the foobar
category:
www.example.com/category/foobar
WordPress will use the category.php
template file to render this page. If you want to override the display for only the foobar
category, crate a template file named category-foobar.php
. (More information: Template Hierarchy: Category Display)
If that doesn’t suit your needs, please provide more detail regarding what exactly you’re trying to accomplish.
Still isn’t what I need.
For example I have posts in this categories:
Postname – Category:
Joe – WordPress
Deer – Wordress
Cat – PHP
In the page http://www.example.com/category/WordPress I see the posts in that category: Joe and Deer.
But what it now does; it shows Joe, Deer AND Cat.
I just want to define that it only shows the posts of that category I’m looking in.
But what it now does; it shows Joe, Deer AND Cat.
That’s because you’ve modified the default loop, somehow.
Please post the loop code for category.php
.
If it is this:
<?php $myposts = get_posts('numberposts=1000');
foreach($myposts as $post) :?>
<div class="post">
<?php the_title(); ?>
</div>
<?php endforeach; ?>
Please replace that with this:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="post">
<?php the_title(); ?>
</div>
<?php endwhile; endif; ?>