WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Exclusion from home page results in exclusion from custom archives page

[Resolved] Exclusion from home page results in exclusion from custom archives page

  • ericminikel

    @ericminikel

    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/

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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

    ericminikel

    @ericminikel

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Exclusion from home page results in exclusion from custom archives page’ is closed to new replies.