WordPress.org

Ready to get started?Download WordPress

Forums

Ultimate Category Excluder
[resolved] Exclusion from home page results in exclusion from custom archives page (3 posts)

  1. ericminikel
    Member
    Posted 11 months ago #

    Awesome plugin! Thrilled with how easy it is to use.

    I have a custom archives.php page which I created based on this guide. My code is as follows:

    <?php
    /*
    Template Name: Archive page
    */
    ?>
    <?php
    $posts_to_show = 1000; //Max number of articles to display
    $debut = 0; //The first article to be displayed
    ?>
    <?php while(have_posts()) : the_post(); ?>
    <h2><?php the_title(); ?></h2>
    <ul>
    <?php
    $myposts = get_posts( "numberposts=$posts_to_show&offset=$debut" );
    foreach($myposts as $post) :
    ?>
    <li><?php the_time('d/m/y') ?>: <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    
    <?php endforeach; ?>
    </ul>
    
    <?php endwhile; ?>

    I have discovered that using UCE to exclude a category from the home page results in also excluding it from this custom archives page. I can't figure out why.

    Not a big deal and totally not your problem, but figured I'd mention it in case there is an easy solution.

    Thanks again.

    http://wordpress.org/plugins/ultimate-category-excluder/

  2. Michael Clark
    Member
    Plugin Author

    Posted 11 months ago #

    Hi Eric,

    Easy solution, since you are using a hand-crafted template page: just remove my plugin from that page. On the line before your $myposts=… add this line

    remove_filter('pre_get_posts','ksuce_exclude_categories');

    That will disable my plugin from kicking in on that one page only. At least, it appears to work on my site. Let me know either way, Mike

  3. ericminikel
    Member
    Posted 11 months ago #

    Brilliant! Yes, that worked! Thanks for your help!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.