Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Excerpts, Read more, Pagination (http://forum.bytesforall.com/forumdisplay.php?f=20)
-   -   [SOLVED] Preserving next/previous navigation with query_posts (http://forum.bytesforall.com/showthread.php?t=2829)

leer Aug 5, 2009 07:56 AM

[SOLVED] Preserving next/previous navigation with query_posts
 
Hi,

I'm using query_posts to exclude a category subtree from my home page, which is breaking next/previous navigation (http://expat.cl/page/2 shows the same posts as http://expat.cl/).

It appears that this is the issue: http://stylizedweb.com/2008/08/13/qu...ation-problem/

I implemented the solution shown on that page, but the behavior remains. Since I'm new to WordPress and PHP, before I start hacking away at Atahualpa I thought I'd run the issue by you all- I may just need a simple correction. I'm using WP 2.8.2 and Atahualpa 3.4.2.

In ATO->Content ABOVE the LOOP I've added:

Code:

<?php /* expat.cl */ if(is_front_page()) { userfn_ignore_directory_posts(); } ?>
That function, located in a separate file, is:

Code:

/*
* Exclude posts belonging to Directory subcategories from Loop
* For use on front page
*/
function userfn_ignore_directory_posts() {
        $pagenum = (get_query_var('pagenum')) ? get_query_var('pagenum') : 1; // preserve pagination
        $dircats = get_categories('child_of=3'); // array of subcategories of Directory       
        $catarray = array();
        $i = 0;
        foreach ($dircats as $cat) { // comma-separated list of negated categories
                $catarray[$i] = $cat->term_id;
                $i++;
        }
        query_posts(array('category__not_in' => $catarray, 'paged' => $pagenum));
}

As far as the category exclusion goes, the function works.

Thanks,
Becca

leer Aug 5, 2009 08:01 AM

Never mind... I just saw that I killed the solution by changing a variable name. It works now.

Great theme :)


All times are GMT -6. The time now is 11:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.