Community Forums › Forums › Archived Forums › General Discussion › Home page: Exclude previously displayed posts
Tagged: featured posts, Featured Tabs, widgets
- This topic has 9 replies, 2 voices, and was last updated 9 years, 9 months ago by
Brad Dalton.
-
AuthorPosts
-
May 21, 2015 at 9:40 am #153102
glauco
MemberHi!
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 #153182Brad Dalton
ParticipantDoes 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.
May 21, 2015 at 8:40 pm #153187glauco
MemberHi!
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 #153189Brad Dalton
ParticipantDoes the tabs widget include an option to exclude previously displayed posts?
May 21, 2015 at 8:55 pm #153190glauco
MemberHi!
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 #153192Brad Dalton
ParticipantYou 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.
May 21, 2015 at 9:06 pm #153193glauco
MemberThank 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 #153194Brad Dalton
ParticipantBecause 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!
May 21, 2015 at 9:13 pm #153195glauco
MemberOh, sorry, I understand now. I'll try!
I'll come back later to tell you the result. 🙂
May 21, 2015 at 9:14 pm #153196Brad Dalton
Participant -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.