-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feagture request: Don't repeat posts when multiple shortcode instances are used on the same page #174
Comments
While there is not a parameter in the shortcode for it (ex: I think it makes sense for this to NOT be in the core plugin, so that you can add support for posts listed outside of the shortcode as well. For instance, on archive pages you could exclude all posts in the current loop from appearing in the shortcode added in the sidebar. In your specific instance, Genesis is already storing the list of displayed post IDs in a global variable so we can leverage that. Anyone wanting to replicate this on a non-Genesis theme should add something like this to their theme. To add this functionality using |
Thank you Bill, the filter does what I wanted to do. This would be super-helpful on WordPress.com, though, where we can't just add a filter. |
Hmm, I'll re-open the issue and consider adding it to the next release. You'll still need to use the above code to exclude non-Display Posts Shortcode posts (ex: the Genesis loop), but I could build this functionality into the plugin for when multiple shortcodes are being used. |
I'm using wordpress without genesis. Can you explain how to avoid that the second shortcode exclude the result of the first one ?
|
This code will work with any theme, not just Genesis themes. What's unique about Genesis is it will include the main loop's post in that variable already, so if you're using this shortcode in the sidebar of your blog archive, it will exclude the main posts from the content area automatically. But if all you're trying to do is exclude posts from the previous Display Posts Shortcode, the code linked above will work for all themes. |
it works well! thank you ! |
Hi there,
I'm working on a site where we're using the display post shortcode with Genesis. I'm working on a filter to change the output of the shortcode so it doesn't repeat previously-displayed posts, using $_genesis_displayed_ids.
I wonder if this would be a feature you could add directly to the shortcode itself.
Thanks for this wonderful shortcode, it makes WordPress much easier to use!
The text was updated successfully, but these errors were encountered: