Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

older post / newer post WordPress

  • SOLVED

when i set my reading settings to 1 post per page the older and newer post navigation links do not work and just display the same post.
[[LINK href="http://trentfineartadvisory.com/tfaa-blog/page/3/"]]http://trentfineartadvisory.com/tfaa-blog/page/3/[[/LINK]]

(this site was built using thematic)

Answers (5)

2010-05-02

Erez S answers:

Replace:
query_posts("cat=1");
with:
query_posts("cat=1&pages=".((get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1));
Enjoy


karenmessing comments:

this did not work.


Erez S comments:

My bad,this is the right line:
query_posts("cat=1&paged=".((get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1));


karenmessing comments:

this still doesnt work.


Erez S comments:

And this one:
query_posts("cat=1&posts_per_page=1&paged=".((get_query_var('paged')) ? get_query_var('paged') : 1));
?


karenmessing comments:

that works. thanks

2010-05-01

Buzu B answers:

The links are working. You can see that the url changes. The problem is when you are pulling the post.Can we see your php code?


karenmessing comments:

i a built a thematic child theme. this is my functions.php:
<?php
// remove thematic_access()
function remove_thematic_actions() {
remove_action('thematic_header','thematic_blogtitle',3);
}
add_action('init','remove_thematic_actions');

function tfaa_header(){
?>
<div id="logo">
<h1><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1>
</div>
<?php
}
add_action('thematic_header','tfaa_header',4);
function get_custom_field($key, $echo = FALSE) {
global $post;
$custom_field = get_post_meta($post->ID, $key, true);
if ($echo == FALSE) return $custom_field;
echo $custom_field;
}

function add_my_query()
{
if (is_page_template('blog.php'))
{
query_posts("cat=1");
}
}
add_action('thematic_above_indexloop', 'add_my_query');


function childtheme_content($content) {
if (is_category()) {
$content= 'full';}
return $content;
}

add_filter('thematic_content', 'childtheme_content');

then the blog.php page (the tfaa blog page is set to this page template)
<?php
/**
* @package WordPress
* @subpackage Default_Theme
*/

/*
Template Name: Blog
*/
?>
<?php

include TEMPLATEPATH . "/index.php";


?>


karenmessing comments:

one last thing i should mention. i changed the my reading settings to 1 post per page in the wordpress backend.


Buzu B comments:

It looks like it's easy to solve. Do you mind sending me you child theme? I'll PM you my email address.


karenmessing comments:

sure.


Buzu B comments:

I'm trying to reproduce the error on my local server, but I can't it seems to work just fine. I have set my reading settings to show 1 post per page. I set the front page as a single page and selected a page to show the posts. I'm using blog.php as the template for the posts page. When I press older or newer it shows the right post. Did you modify thematic?

2010-05-01

Thomas Maier answers:

I suppose the PHP code, which should display the post, lost it’s personal ID. Compare the original Wordpress standard theme (index.php) with your one.

2010-05-02

Rok Don answers:

Use
query_posts('posts_per_page=1&cat=1');

instead of
query_posts("cat=1");


karenmessing comments:

i tried this and it did not work. clicking on older posts takes you to the same post...

2010-05-02

Utkarsh Kukreti answers:

Could you change the setting to 1 post per page on the site?