I'm getting 404 errors all over my site, I believe this is related to permalinks. It always happens via archives.php
My category "archives" returns posts that aren't even in it!: [[LINK href="http://kaiio.com/?cat=1"]]http://kaiio.com/?cat=1[[/LINK]]
Could <?php
be the culprit?
query_posts('posts_per_page=3&paged='.$paged);
if (have_posts()) :
?>
Here is my archives.php
<?php get_header(); ?>
<div id="container">
<div id="sidebar_content">
<!-- Grab posts -->
<?php
query_posts('posts_per_page=3&paged='.$paged);
if (have_posts()) :
?>
<?php while (have_posts()) : the_post(); ?>
<!-- Begin excerpt wrap -->
<div class="excerpt_wrap">
<div class="excerpt_line">
<!-- Excerpt and excerpt image-->
<div class="index">
<!-- Excerpt: image -->
<a href="<?php the_permalink('') ?>">
<?php
// call the function in the loop of your template
$images = get_all_image_from_post();
// pass each image src to TimThumb
foreach ($images as $image) { ?>
<img src="<?php echo get_template_directory_uri(); ?>/scripts/timthumb.php?src=<?php echo $image; ?>&h=240&w=280" class="index" alt="<?php the_title_attribute(); ?>" title="<?php the_title_attribute(); ?>" />
<?php } ?>
<?php get_the_excerpt() ?>
</a>
<!-- Excerpt: post time and author -->
<div class="sub-title">
<?php the_time("F j, Y"); ?> / <?php the_author_posts_link(); ?> / <?php the_category(', ') ?>
</div>
<!-- Excerpt: post title -->
<div class="index_title">
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</div>
<!-- Excerpt: words -->
<?php the_excerpt(); ?>
</div>
<!-- End excerpt wrap -->
</div>
</div>
<?php endwhile; ?>
<!-- Next/Previous entries -->
<div class="mp_archive">
<div id="more_posts">
<div class="oe"><?php next_posts_link('« Older Entries') ?></div><div class="re"><?php previous_posts_link ('Recent Entries »') ?></div>
</div>
</div>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
</div>
</div>
<?php get_footer(); ?>
Sébastien | French WordpressDesigner answers:
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('posts_per_page=3&paged='.$page);
Sébastien | French WordpressDesigner comments:
sorry, i did a mistake
the nice code :
$page = (get_query_var('page')) ? get_query_var('page') : 1;
query_posts('posts_per_page=3&paged='.$page);
Lucas Wynne comments:
Nope, didn't work.
Sébastien | French WordpressDesigner comments:
???
have you try the second code or the first ?
Lucas Wynne comments:
Second.
Sébastien | French WordpressDesigner comments:
could you validate another time your permalink
Sébastien | French WordpressDesigner comments:
i am looking at your site, that seems nice
Espreson Media answers:
global $more;
// set $more to 0 in order to only get the first part of the post
$more = 0;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("showposts=10&paged=".$paged);
$wp_query->is_category = true; $wp_query->is_home = false;
Lucas Wynne comments:
This doesn't work either.
Espreson Media comments:
Try the above
Lucas Wynne comments:
Not working.
Espreson Media comments:
Where are you puting it
Lucas Wynne comments:
Where <?php
was.
query_posts('posts_per_page=3&paged='.$paged);
if (have_posts()) :
?>
Lucas Wynne comments:
I'm getting closer with this page markup, as it calls only from the desired category:
<?php get_header(); ?>
<div id="container">
<div id="sidebar_content">
<!-- Grab posts -->
<?php
/* Queue the first post, that way we know
* what date we're dealing with (if that is the case).
*
* We reset this later so we can run the loop
* properly with a call to rewind_posts().
*/
if ( have_posts() )
the_post();
?>
<!-- Begin excerpt wrap -->
<div class="excerpt_wrap">
<div class="excerpt_line">
<!-- Excerpt and excerpt image-->
<div class="index">
<!-- Excerpt: image -->
<a href="<?php the_permalink('') ?>">
<?php
// call the function in the loop of your template
$images = get_all_image_from_post();
// pass each image src to TimThumb
foreach ($images as $image) { ?>
<img src="<?php echo get_template_directory_uri(); ?>/scripts/timthumb.php?src=<?php echo $image; ?>&h=240&w=280" class="index" alt="<?php the_title_attribute(); ?>" title="<?php the_title_attribute(); ?>" />
<?php } ?>
<?php get_the_excerpt() ?>
</a>
<!-- Excerpt: post time and author -->
<div class="sub-title">
<?php the_time("F j, Y"); ?> / <?php the_author_posts_link(); ?> / <?php the_category(', ') ?>
</div>
<!-- Excerpt: post title -->
<div class="index_title">
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</div>
<!-- Excerpt: words -->
<?php the_excerpt(); ?>
</div>
<!-- End excerpt wrap -->
</div>
</div>
<!-- Next/Previous entries -->
<div class="mp_archive">
<div id="more_posts">
<div class="oe"><?php next_posts_link('« Older Entries') ?></div><div class="re"><?php previous_posts_link ('Recent Entries »') ?></div>
</div>
</div>
<?php
/* Since we called the_post() above, we need to
* rewind the loop back to the beginning that way
* we can run the loop properly, in full.
*/
rewind_posts();
/* Run the loop for the archives page to output the posts.
* If you want to overload this in a child theme then include a file
* called loop-archive.php and that will be used instead.
*/
get_template_part( 'loop', 'archive' );
?>
</div>
<?php get_sidebar(); ?>
</div>
</div>
<?php get_footer(); ?>
Espreson Media comments:
Please replace This :
<?php
query_posts('posts_per_page=3&paged='.$paged);
if (have_posts()) :
?>
With this one:
<?php
global $more;
// set $more to 0 in order to only get the first part of the post
$more = 0;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("showposts=10&paged=".$paged);
$wp_query->is_category = true; $wp_query->is_home = false;
if (have_posts()) :
?>
Lucas Wynne comments:
It's still calling posts from categories I don't have it set to call from and I don't want to set it to call from only one category manually.
Just Me answers:
Your site is acting weird, switching themes while browsing it. What did you set the url of your WordPress installation to in the General settings?
Lucas Wynne comments:
I cleared the database. I'm actively trying to solve the problem while everybody else does.
Denzel Chia answers:
Hi,
Have you tried using WordPress template hierarchy?
<blockquote>
category-{slug}.php - If the category's slug were news, WordPress would look for category-news.php
</blockquote>
Having a specific category template will exclude those post not within that category.
Thanks.
Denzel
Lucas Wynne comments:
I'm going to be using this theme on other sites, posts are supposed to be pulled from the archive of the category that the user is currently on... so that is only a temporary fix.