WordPress.org

Ready to get started?Download WordPress

Forums

Frontpage category filter
affects not only the frontpage (4 posts)

  1. yantei
    Member
    Posted 2 years ago #

    I've wasted some time looking for the bug in my code fetching attachments
    It was this plugin adding some additional inner joins to all my queries not only on frontpage...

    http://wordpress.org/extend/plugins/frontpage-category-filter/

  2. mccormicky
    Member
    Posted 1 year ago #

    It's weird - my wish seemed like such a simple one!
    I wanted to hide 3 or 4 categories from the front page.
    In Settings > Reading I selected Front page displays Latest Posts. Then I went about narrowing that selection down...

    This was the only plugin (out of 5 that I activated - one at a time of course)
    as well as various custom filtering codes that I tried adding to my theme's functions.php which worked for my project.

    Usually I use a Static Page for the home page of the site then start adding stuff in.
    It seems to be easier to set things up that way which is why I do it like that. This time I couldn't go that route and came up against this odd issue of everything from every category showing on the home page no matter what I tried.

    Anyway I'm basically saying this plugin works. So if you're like me and having a hard time getting posts from some categories to stay out of your home page try this plugin. It also didn't mess up anything else (so far) : ).

  3. infindebula
    Member
    Posted 1 year ago #

    I'm a WordPress noob. I've had a site up for a while now using frontpage category filter on WP 3.3.1. I wanted to try doing a "gallery" post last night, and I just could not get it to work.

    I started disabling plugins on my test site (presently WP 3.2.1) -- I tried disabling everything except frontpage-category-filter because I assumed it would be pretty benign.

    Finally I came across this: http://wordpress.org/support/topic/image-galleries-not-working-in-33

    Sure enough, disabling the plugin solved the problem.

    Previously I was trying to use an Events Calendar plug-in as well, and I also could never get that one to work properly either ... now that I see the above post ("It was this plugin adding some additional inner joins to all my queries not only on frontpage...") I'm starting to suspect frontpage-category-filter was breaking the calendar as well.

    Instead of using this plugin, I will figure out a way to hardcode my index.php to only load my "frontpage" category when it is the front page (as soon as I get a chance)

  4. mccormicky
    Member
    Posted 1 year ago #

    I wrote that this plugin was working to exclude posts from certain categories from showing on the frontpage

    But then I went to my WP-E-Commerce Products Page - the Page that has the shortcode [ productspage ] and my Featured Products were getting wiped out.

    So I changed the query in frontpage-category-filter.php lines 50 to 56:

    if ( $query->is_home AND $query->get('post_type') != 'nav_menu_item' ) {
    	        $query->set('category__in', explode(',', $featured_category_id));
    	        //$query->set('posts_per_page', get_option('merlic_filtercategory_postslimit'));
    	    }
    
    	    return $query;
      }

    TO (edited code):

    if ( $query->is_main_query() && $query->is_front_page() && $query->get('post_type') != 'nav_menu_item' ) {
    	        $query->set('category__in', explode(',', $featured_category_id));
    	        //$query->set('posts_per_page', get_option('merlic_filtercategory_postslimit'));
    	    }
    
    	    return $query;
      }

    Which fixed the issue for me.

    I got the idea from this post in another forum:
    http://wordpress.stackexchange.com/questions/58033/pre-get-posts-in-combination-with-is-front-page

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic