ThemeShaper Forums » Thematic

[closed]

Paged query not seeing what page it is

(6 posts)
  • Started 9 years ago by Lasson
  • Latest reply from Lasson
  • This topic is not resolved
  1. Lasson
    Member

    Hi

    I am going nuts over this. Trying to get blogposts to show up on a page. Made a page template from page.php where I only added one line of code, namely my loop function

    // calling the widget area 'page-bottom'
    	        get_sidebar('page-bottom');
    
    	        my_index_loop_column();?>
    
    			</div><!-- #content -->

    The loop function goes like this

    function my_index_loop_column() {
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	query_posts('showposts=6&paged=' . $paged);
    	global $more;
    	$more = 0;
    	$col = 1;
    	while (have_posts()) : the_post();
    	if ($col == 1) echo "<div class=\"row\">";?>
    			<div id="post-<?php the_ID() ?>" class="post col<?php echo $col;?>">
    			<?php thematic_postheader();?>
    			<div class="entry-content">
    			<?php thematic_content();
    			echo $paged;?>
    			</div><!-- .entry-content-->
    			<?php thematic_postfooter(); ?>
    		</div><!-- .post -->
    	<?php 		$count = $count + 1;
    				if ($col == 1) echo "</div>"; (($col==1) ? $col=2 : $col=1);
    		endwhile;
    	thematic_navigation_below();
    	wp_reset_query();
    }

    It works except that going to page 2 does not work. I have added a printout of the variable $paged as you can see and it stays on 1 all the time. When I activate the pagenavi plugin I can see the it counts out the correct number of pages and the link to page 2 works… I go to host/page/2 but its the same posts as on page 1 that show up. What the heck am I doing wrong?

    This method worked for another site I made but this time I am on wp 3.0 and thematic 0.9.7.4. Maybe that update makes it not work.

    Posted 9 years ago #
  2. Lasson
    Member

    A little more information. But problem getting weirder I think. The same problem persists when I use a clean install of thematic 0.9.7.7 (no child theme) and the included template template-page-blog.php. Now I'm on wp 3.0.1 clean install with no plugins and I erased the whole test database and started from scratch.

    So. I make a page called "Home" and apply template-page-blog.php to it. Set that page to be the front page in reading settings. The page shows the latest posts all right and the link "older posts" takes me to localhost/page/2. But! Its still the same first page articles and the link to older posts is still to the same /page/2.

    I am going crazy… ok I just ruined one day on it so far… so not that much I guess :). But please, does anyone recognize this, can reproduce it, have any clues whatsoever, or can just give some sympathy? :)

    Oh I should mention that it is a multisite install. And if I choose the front page to display "my latest posts" the pagination works fine. I did look at the 0.9.7.6 release notes and added the things mentioned there.

    Posted 9 years ago #
  3. Lasson
    Member

    furhter info… which I should have realised much sooner. Both my template and the thematic template works when the page is not used as the front page. And my other site actually uses the regular index as front page I realize now. So what I am trying to do might actually not work for anyone (which is a relieve)

    So I guess I have to figure some other solution out. I can have the regular index page going as font page and add in other front page content with hooks. But I wanted the user to be able to edit the top part of the front page and have the news flow at the bottom.

    Posted 9 years ago #
  4. Lasson
    Member

    ok last post of the night… this is what I did for now, I added this to above_index_loop()

    $pagey = (get_query_var('paged')) ? get_query_var('paged') : 1;
    if ($pagey == '1')	{
    		query_posts('pagename=home');
    		while (have_posts()) : the_post();?>
    		<div id="post-<?php the_ID() ?>" class="<?php thematic_post_class() ?>">
    		<div class="entry-content">
    		<?php the_content();
    		wp_link_pages("\t\t\t\t\t<div class='page-link'>".__('Pages: ', 'thematic'), "</div>\n", 'number');
                    edit_post_link(__('Edit', 'thematic'),'<span class="edit-link">','</span>')?>
    		</div><!-- .entry-content-->
    		</div><!-- .post --> <?php
    		endwhile;
    		wp_reset_query();
    }

    And then removed the page home from menus. The editor will then just edit that page and thus edit the top part of index.

    If anyone has a smarter idea let me know, this feels like a true "hack", although it will work for my purposes.

    Posted 9 years ago #
  5. Hi,

    I just tested your code using this exactly:

    function child_page_loop() {
    	my_index_loop_column();
    }
    add_action('thematic_belowpagebottom','child_page_loop');
    
    function my_index_loop_column() {
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	query_posts('showposts=6&paged=' . $paged);
    	global $more;
    	$more = 0;
    	$col = 1;
    	while (have_posts()) : the_post();
    	if ($col == 1) echo "<div class=\"row\">";?>
    			<div id="post-<?php the_ID() ?>" class="post col<?php echo $col;?>">
    			<?php thematic_postheader();?>
    			<div class="entry-content">
    			<?php thematic_content();
    			echo $paged;?>
    			</div><!-- .entry-content-->
    			<?php thematic_postfooter(); ?>
    		</div><!-- .post -->
    	<?php 		$count = $count + 1;
    				if ($col == 1) echo "</div>"; (($col==1) ? $col=2 : $col=1);
    		endwhile;
    	thematic_navigation_below();
    	wp_reset_query();
    }

    Pagination worked fine for me maybe there is something else you're missing. Did you try rebuilding permalinks?

    -Gene

    Posted 9 years ago #
  6. Lasson
    Member

    Yes it works on the page. But when I put that page as front page (in settings/reading) and visit the front page the pagination does not work anymore.

    Thanks for checking this out though.

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.