• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Home page: Exclude previously displayed posts

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Home page: Exclude previously displayed posts

This topic is: not resolved

Tagged: featured posts, Featured Tabs, widgets

  • This topic has 9 replies, 2 voices, and was last updated 10 years, 7 months ago by Brad Dalton.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • May 21, 2015 at 9:40 am #153102
    glauco
    Member

    Hi!

    I use News Pro Theme.

    In my Home page, when inserting widgets for Genesis Featured Posts, I always mark "Exclude previously displayed posts". It works fine.

    However, I have a problem since I added the widget GENESIS FEATURED TABS.

    Right after the Featured Tabs I have a widget with Featured Posts. In this Featured Posts, I check that option to NOT display previously diisplayed posts. But this time the option does not work. So, my readers see the same post featured again, like this:

    It's strange. The firts featured post right after the featured tabs should never be the same post.

    Please, is there a way to solve this?

    Thank you.

    http://viagemfantastica.com/
    May 21, 2015 at 8:17 pm #153182
    Brad Dalton
    Participant

    Does the tabs widget include an option to exclude previously displayed posts?

    If not, you can see how its done in the genesis featured posts widget code.


    Tutorials for StudioPress Themes.

    May 21, 2015 at 8:40 pm #153187
    glauco
    Member

    Hi!

    The Tabs widget appears first.

    The following widget, Featured Posts, is set to NOT show previously displayed posts, but it's not working.

    May 21, 2015 at 8:53 pm #153189
    Brad Dalton
    Participant

    Does the tabs widget include an option to exclude previously displayed posts?


    Tutorials for StudioPress Themes.

    May 21, 2015 at 8:55 pm #153190
    glauco
    Member

    Hi!

    No, it doesn't. But it comes first, so there's no previous post to exclude. Maybe you would suggest to insert it after the other widget.

    May 21, 2015 at 9:04 pm #153192
    Brad Dalton
    Participant

    You could add the Genesis featured posts functionality to exclude previously displayed posts to the tabs widget.

    if ( $instance['exclude_displayed'] )
    	$query_args['post__not_in'] = (array) $_genesis_displayed_ids;
    
    	$wp_query = new WP_Query( $query_args );
    
    		if ( have_posts() ) : while ( have_posts() ) : the_post();
    
    			$_genesis_displayed_ids[] = get_the_ID();
    

    And add the checkbox to the widget.

    <p>
    <input id="<?php echo $this->get_field_id( 'exclude_displayed' ); ?>" type="checkbox" name="<?php echo $this->get_field_name( 'exclude_displayed' ); ?>" value="1" <?php checked( $instance['exclude_displayed'] ); ?>/>
    <label for="<?php echo $this->get_field_id( 'exclude_displayed' ); ?>"><?php _e( 'Exclude Previously Displayed Posts?', 'genesis' ); ?></label>
    </p>
    

    Untested and may require a bit more work.


    Tutorials for StudioPress Themes.

    May 21, 2015 at 9:06 pm #153193
    glauco
    Member

    Thank you for your attention.

    The Featured Posts widget comes after the Featured Tabs.

    This Featured Posts is already set to NOT show previously displayed posts, but this is not working.

    May 21, 2015 at 9:12 pm #153194
    Brad Dalton
    Participant

    Because the tags widget is excluded from the main loop as well as the custom loop created by the featured posts widget and creates its own new WP_Query which is why i suggest you add that functionality to the plugin.

    So the bottom line in my opinion is the featured posts widget works because it includes the exclusion option but the tabs widget doesn't because it doesn't include theta option. Might be wrong!


    Tutorials for StudioPress Themes.

    May 21, 2015 at 9:13 pm #153195
    glauco
    Member

    Oh, sorry, I understand now. I'll try!

    I'll come back later to tell you the result. 🙂

    May 21, 2015 at 9:14 pm #153196
    Brad Dalton
    Participant

    No problem.


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 10 posts - 1 through 10 (of 10 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble