Display WordPress Posts Widget – Order By Option
-
Hello,
Currently, the Display WordPress Posts Widget only brings in the X most recent posts.
Is there any way that I can tell it to:
a) Randomly bring in posts?
b) Select which Categories it pulls from?I’ve been experimenting with ShortCodesUltimate and it has those options, but it pulls from the internal website (not an external WordPress site like this widget).
Thanks,
John
-
Thats’s not possible at the moment, but that’s a good idea. We’ll consider adding an option to control the posts returned by the REST API in the next release.
You can follow our progress here:
https://github.com/Automattic/jetpack/pull/2209Since I submitted a patch, feel free to apply the patch to your version of Jetpack until it gets merged!
Hi Jeremy,
I might want to give your patch a try and think that I can implement it based upon your prior help/instructions and example in the link above.
Do any of the Query Parameters ( at https://developer.wordpress.com/docs/api/1.1/get/sites/%24site/posts ) allow it to randomly choose posts (rather than by Category, or Tags, etc.) ?
Thanks,
John
Do any of the Query Parameters allow it to randomly choose posts
I’m afraid not, but I’ll ask our developers if we could add a new
randomparameter. I’ll get back to you when I have some news!Hi Jeremy,
The OrderBy/Random option in Recent Posts Extended widget has worked really well for internal blog posts, showing the reader a different set of posts each time they browse another page.
It would be great if your Display WordPress Posts widget could do the same for external blog posts, rather than the same static posts.
Has there been any further consideration of this idea/feature?
Thanks,
John
Has there been any further consideration of this idea/feature?
I’m afraid not. I’ll ask our API developers again, and see if we can make progress on this.
Thank you!
After some discussion, it doesn’t look like we’ll be able to add that option in the next few months.
You could, however, use the following work-around:
- Install this plugin on the site you want to pull posts from:
https://wordpress.org/plugins/rest-api/ - Install this plugin on the site where you’ll be displaying the posts:
https://wordpress.org/plugins/rest-api-post-embeds/ - In your sidebar, add a new text widget, and follow the instructions here to create a shortcode that will display the posts you need. You’ll also want to include the
order_by="rand"parameter. Here is an example of a shortcode you could build:
[jeherve_post_embed url="jeremy.hu" order_by="rand" wpapi="true" number="5" image_size="202,114" include_credits="false" include_excerpt="false"]
I hope this helps!
Wow Jeremy… this is awesome… thanks !!!!
I posted a quick follow up in your Rest-API-Post_Embeds Plugin support thread.
John
- Install this plugin on the site you want to pull posts from:
The topic ‘Display WordPress Posts Widget β Order By Option’ is closed to new replies.