WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Older links in categories do not show up (using WordPress with SQLite) (2 posts)

  1. gnucco
    Member
    Posted 4 years ago #

    Hi, I'm a new wordpress user migrating from a cutenews installation. I'm using WordPress through Other-Ext-WP plugin which let me use SQLite on my no-my sql domain.
    I have two major problems: the first one is that links to older posts in a category do not show up, and since I have this problem on all the blogs I tests with sqlite, with all plugins and widgets disabled, I think it's a sqlite-related problem; the second one is that I can't edit comments, since if I try to edit them, when I click on "update comment" the comment is NOT updated.
    If you can help me, please have a look at a test site of mine,
    http://arigato.altervista.org/wordpress/
    as you can see, Uncategorized category has 8 posts, but if you click on it 5 posts show up (5 is the number of recent posts in my settings) but older posts link DOESN'T show up.

    Thanks, Fede.

  2. gnucco
    Member
    Posted 4 years ago #

    Hi, finally I've found a solution (it could not be the best, but it seems to work).
    First I created a category template for each category (let's say I have 4 categories), copying the file index.php of my theme 4 times and renaming them category-XX.php, where XX is the ID category. Then I edited those 4 files adding at the beginning of files the following code, taken and adapted from http://www.web-templates.nu/2008/09/21/get_category_count/ :

    function wt_get_category_count($input = '') {
    	global $wpdb;
    	if($input == '')
    	{
    		$category = get_the_category();
    		return $category[0]->category_count;
    	}
    	elseif(is_numeric($input))
    	{
    		$SQL = "SELECT $wpdb->term_taxonomy.count FROM $wpdb->terms, $wpdb->term_taxonomy WHERE $wpdb->terms.term_id=$wpdb->term_taxonomy.term_id AND $wpdb->term_taxonomy.term_id=$input";
    		return $wpdb->get_var($SQL);
    	}
    	else
    	{
    		$SQL = "SELECT $wpdb->term_taxonomy.count FROM $wpdb->terms, $wpdb->term_taxonomy WHERE $wpdb->terms.term_id=$wpdb->term_taxonomy.term_id AND $wpdb->terms.slug='$input'";
    		return $wpdb->get_var($SQL);
    	}
    }
    
    <?php $max_page=floor(wt_get_category_count(XX)/5); ?>

    where again XX is the ID category and 5 is the number of posts per page.

    Now everytime I click on a category $max_page variable is computed and vavigation should work as normal.

    bye

Topic Closed

This topic has been closed to new replies.

About this Topic