Support » Fixing WordPress » Could someone correct this plugin’s code?

  • Hi,

    I’m building an articles directory site using the “Articles Directory” plugin and theme and one of the suggested add-on plugins is giving me a 404 error.

    Could someone please have a look at the code to see what’s wrong with it? I would like to have it running in a 2.5.1 environment (in a sub folder) and using pretty permalinks.

    <?php
    /*
    Plugin Name: Kinderlose
    Plugin URI: http://guff.szub.net/kinderlose
    Description: Remove posts from child categories in (parent) category queries.
    Version: R1
    Author: Kaf Oseo
    Author URI: http://szub.net
    
    	Copyright (c) 2007 Kaf Oseo (http://szub.net)
    	Kinderlose is released under the GNU General Public License (GPL)
    	http://www.gnu.org/licenses/gpl.txt
    
    	This is a WordPress 2.3 plugin (http://wordpress.org).
    
    	Inspired by Michael D. "mdawaffe" Adams' Just One Category and
    	Rich Hamilton's No SubCats.
    */
    
    function kinderlose_where($where) {
    	if ( is_category() ) {
    		global $wp_query;
    		$where = preg_replace('/.term_id IN \(\'(.*)\'\)/', '.term_id IN (\'' . $wp_query->query_vars['cat'] . '\') AND post_type = \'post\'', $where);
    	}
    
    	return $where;
    }
    
    add_filter('posts_where', 'kinderlose_where');
    ?>

    Thanks,
    Gene

Viewing 13 replies - 1 through 13 (of 13 total)
  • whooami

    (@whooami)

    Member

    That is one of the forum moderator’s plugin — I highly doubt there is anything “wrong” with it. The plugin page says its for 2.3, as does the plugin itself.

    http://guff.szub.net/2007/11/30/kinderlose/

    Thanks Whoo, I don’t want to step on anybody’s toes but I wish there a way to maybe change a few things to make it 2.5.1 compatible.

    Or I wonder if there is another plugin that would accomplish the same thing but for the latest WP release. I’ve searched but nada…

    Are you sure this plugin is the culprit? Not much has changed between 2.3 and 2.5 regarding the terms tables.

    I’ve tried it only using the “Articles Directory” and disabled all the others. I then activated Kinderlose, clicked on a parent directory I got a 404 error. When I disabled it and clicked the parent directory, I got all the posts (normal behavior).

    If you want to check my site, I’ll activate it so you’ll see what I mean. Strangest this is that it works well on the Articles Directory Author’s site (could it be that their WP installation is in the root directory? I don’t have a clue…).

    Thanks,
    Gene

    Gee, guess it would help if I’d include the link, sorry…

    AltMedPress

    Duhh…

    Plugin works fine for me, even with wordpress in a subfolder (e.g. http://www.sample.com/wordpress).

    The plugin works perfectly on my present 2.5.1 blog.
    What is “articles directory”?

    Really strange that it works on your blogs but not mine…

    Moshu, you’ll find both the Articles directory plugin either here (in plugins) or if you want both the plugin and the theme, click here.

    I am not sure I am going to install it now… but there is always a possibility that two plugins are mutually excluding (killing) each other – expecially when they affect the same feature: categories.

    Hi Moshu

    I am not sure I am going to install it now… but there is always a possibility that two plugins are mutually excluding (killing) each other – expecially when they affect the same feature: categories.

    The blog I have it installed on only had the article directory plugin enabled (fresh install) and it did the same thing, 404…

    BTW, installed Kinderlose on another blog and the same thing happens, when I click on the parent directory, I get the infamous 404 error plus “Ooops…Where did you get such a link ?”

    LOL!
    Gene

    Just FYI, the test blog where the plugin worked is using the default Permalink structure.

    Just FYI, the test blog where the plugin worked is using the default Permalink structure.

    I’ll give it another try on a clean install and leave the permalinks to default.

    Funny thing is, the Articles Directory site uses “pretty” permalinks, see it here. Mind you, looks like their WP install is in the mail folder.

    Weird…
    Gene

    Nah, didn’t work either…

    Might as well forget it.

    Thanks guys,
    Gene

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Could someone correct this plugin’s code?’ is closed to new replies.