WordPress.org

Ready to get started?Download WordPress

Forums

Could someone correct this plugin's code? (14 posts)

  1. raygene
    Member
    Posted 6 years ago #

    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

  2. whooami
    Member
    Posted 6 years ago #

    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/

  3. raygene
    Member
    Posted 6 years ago #

    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...

  4. MichaelH
    Member
    Posted 6 years ago #

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

  5. raygene
    Member
    Posted 6 years ago #

    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

  6. raygene
    Member
    Posted 6 years ago #

    Gee, guess it would help if I'd include the link, sorry...

    AltMedPress

    Duhh...

  7. MichaelH
    Member
    Posted 6 years ago #

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

  8. moshu
    Member
    Posted 6 years ago #

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

  9. raygene
    Member
    Posted 6 years ago #

    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.

  10. moshu
    Member
    Posted 6 years ago #

    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.

  11. raygene
    Member
    Posted 6 years ago #

    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

  12. MichaelH
    Member
    Posted 6 years ago #

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

  13. raygene
    Member
    Posted 6 years ago #

    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

  14. raygene
    Member
    Posted 6 years ago #

    Nah, didn't work either...

    Might as well forget it.

    Thanks guys,
    Gene

Topic Closed

This topic has been closed to new replies.

About this Topic