Forum Replies Created
Thanks Elvin, unfortunately this code just blanks the page (except for the header).
I tried similar code previously and had the same problem each time – no content below the header.
Thanks Elvin, I created a custom field using ACF. It’s a number field. Unfortunately I can’t use date as ‘time’ is the length of time of a bike ride, see the output of the WP Show Posts here (https://rideorange.com.au/routes/).
I tried using a filter to do the same following code examples in the forum but I couldn’t get it to work. This shortcode works but every time I edit the page i’ll need to correct the shortcode settings to make sure it keeps working which isn’t the end of the world, just not ideal…
I’m using the Alpha version of WP Show Posts 1.2.0 Alpha3 too.
So in the Classic block, it doesn’t get converted but the orderby isn’t working either.
Thanks Elvin, already running 5.8.2, will disable all plugins and get back to you.
Can’t seem to edit the post again, here is a screen grab example:
I’m using this shortcode to sort my posts by a custom field and it works well, except WordPress is converting the & to html character & (and amp semi-colon) each time I edit the page resulting in the code not working – is there a way to stop this?
[wp_show_posts id="213" settings="meta_key=time&orderby=meta_value_num&order=ASC"]
Just realised this forum is doing the same thing so I can’t show the example…
thanks Tom, will do
Thanks Tom, that’s perfect & so simple.
On a side note, i’m trying to write some functions using custom post types & custom terms and struggling – do you recommend any WP forums I could ask questions?
Excellent, thanks Tom – i’ll give it a go.
Thanks Tom, that seems to have worked. You’re a lifesaver (again!).
Anything else I should do?
Further to this, I am having an issue with the sorting on a non-custom field – ID. If you have a look at this page (https://www.orangewinefestival.com.au/event-program/weekend-two-events/), you will see numbers at the bottom of each event (882, 883 etc) these are the ID’s for each Event, using get_the_ID(). Notice that even though I am ordering by ID, set to ASC, it isn’t working.
Note I have removed the ‘settings’ from my WPSP shortcode, so it’s just [wp_show_posts id=”27″ ]
Also when I set the order in WPSP to DESC it changes the order, but it still isn’t correct.
This is getting to be an urgent issue now so any help would be appreciated – thanks.
Sorry to bring this up again. I’m having an issue with this method and was wondering if you could shed any light.
The code works OK when I use a WPSP List to show all posts for my CPT (Events)(eg. https://www.orangewinefestival.com.au/event-program/events-program/), but when I choose a taxonomy (event_type) it stops working (eg. https://www.orangewinefestival.com.au/event-program/weekday-events/).
I am using a custom field to sort by, a field I have created called event_id, which is a number field. I tried setting that as a text field but it didn’t fix the issue.
If I change to order by field in WPSP List settings then the order will change, so it appears that when a Custom Taxonomy is being used, the ‘settings’ part of the shortcode is being ignored.
It works! Once again you’ve come to the rescue – thanks so much, your help is really appreciated.
For anyone else looking to do the same thing, here is the shortcode I ended up with. Needed to add the meta_key to the above code.
Note the meta_key is the name of the Custom Field, in my case it was event_id.
[wp_show_posts id=”16″ settings=”meta_key=event_id&orderby=meta_value&order=ASC”]
Thanks – didn’t see you had posted this, will give it a try.