WPIntell

Source evidence

Hook to show future posts

ACF Recent Posts Widget · support · 2019-04-29T11:36:00+00:00

mixedsentiment
mediumseverity
0.85relevance
19replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

4 / 27 rows with source links

14.8% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

23 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
franklin82 resolved
I’m using this to show upcoming events in the sidebar which is working nicely but if I change the order from DSC to ASC I get all my old events showing. Is there a way to say only show the next 5 events in ASC order greater than today’s date? Thanks! Hey @franklin82 , Yes, the behavior is expected. At first glance I would have to apply some code changes to give you such an ability. I will have to think of the solution so I can’t help you right away – probably this will take longer than a week due to my holiday this week. Anyway perhaps you could temporarily add some posts to a tag / category? This would limit the number of posts being displayed within the widget to only those from the asssigned. Is there a way to say only show the next 5 events in ASC order greater than today’s date? May you please rephrase that? Regards, Rafal Hi @gicolek , What i’m looking to do is show any post based on my custom field ‘event-date’ and if the date is greater than todays date shows them in ASC order. Hope that makes more sense. Thanks! Michael Hey @franklin82 , Does this part of the documentation help you out: The Meta Value field supports an array of elements, so that all of the meta_compare parameters could be used. To do so, please specify the two parameters separated by semicolon, for instance: 1234;12345. The plugin will convert these into an array and apply the proper operation for the two. Whatsmore the [date] shortcode can be used here. It takes the timestamp paramater as an argument, which is required – the possible arguments are the same as for the function described here: http://php.net/manual/pl/function.strtotime.php . For instance [date +1 day] would generate the tomorrow date in “Ymd” format. This can be used with custom meta field date. I’ll do my best to reply ASAP, but can’t promise anything now. Regards, Rafal @gicolek , It has helped but but it’s just the order of those posts now, not sure how would be best to do it. No rush on this, this would be the icing on the cake 🙂 Hello again @franklin82 , My apologies for such a huge delay! May you please provide with screenshots of your setup? Please include the following: 1. ACF Custom Fields Setup. 2. Widget / Shortcode setup with the values you have specified. 3. A sample future post setup. I’d like to recreate that directly within my environment to make sure we’re on the same plate here. Sincerely, Rafał Hi @gicolek , No problems – thanks for coming back to me, screenshots of the setup for you. ACF Custom Fields Setup Widget sample future post setup I did also change the acfrpw/loop-inner.php (line 61) to the below to include the event-date field. <?php endif; ?> <a href="<?php the_permalink(); ?>" rel="bookmark"> <span class="date meta-item"><?php the_field( 'event-date' ); ?></span> <h3 class="acf-rpw-title"><?php get_the_title() ? the_title() : the_ID(); ?></h3></a> Let me know if you need anything else. Thanks! Hey @franklin82 , Thanks! I’ll recreate that setup. Can you also share a screenshot of the Event Date field setup? There are some settings that may affect the problem you’re dealing with. Outside of that I don’t need anything else! Sincerely, Rafał Hi @gicolek , That should be in the first link included above or do you mean from somewhere else? Thanks, Michael Hi @franklin82 , Right, but I would like to see the field “open” to see the settings of the date field 🙂 Can you make sure it’s toggled on? Sincerely, Rafal @gicolek gotcha, Here you go: https://ibb.co/G038csC Michael Thanks @franklin82 , That’s exactly it 🙂 I’ll get back to to you tomorrow tops. Thanks for the patience. Regards, Rafal Hello @franklin82 , Here’s the solution: 1. Widget setup: https://www.screencast.com/t/RpA8IF8kwN6Q (note you can’t use acf meta key within the Meta Value field – it accepts the date only :)) 2. ACF field setup: https://www.screencast.com/t/fXZHfYEpGLo Locally, on Vanilla it gives correct results, not listing older posts: https://www.screencast.com/t/xcDWkFha5 Let me know if that works for you! Cheers, Rafal Hey @gicolek thanks for that, I’ll give a go. Do I need to need that code in shown on the last image anywhere, if so where should that be? Thanks! Michael Hello @franklin82 , No, you don’t – it’s just a debug info that can be ignored. Sorry if that caused some confusion. Sincerely, Rafał This reply was modified 7 years ago by Rafał Gicgier . This reply was modified 7 years ago by Rafał Gicgier . Hey @gicolek , Does the ACF field output need to be in ‘Ymd’ format or can this be changed to ‘F j, Y’. In the test you’ve done the date is showing correctly but for me it displays a date like ‘20190523’ which isn’t very friendly. Thanks Hey @franklin82 , I don’t think so, no. Regards, Rafal Hey again @franklin82 , Do you think I can mark the topic as resolved? Sincerely, Rafał Hey @gicolek , Yeah I think its working as I want it to. Thanks for your help! Michael Great! @franklin82 do not hesitate to reach to me with any other problem in the future. Also I will appreciate a review of the plugin 🙂 Sincerely, Rafał

Comments

19 shown
Rafał Gicgier 2019-04-29T12:26:00+00:00

Hey @franklin82 , Yes, the behavior is expected. At first glance I would have to apply some code changes to give you such an ability. I will have to think of the solution so I can’t help you right away – probably this will take longer than a week due to my holiday this week. Anyway perhaps you could temporarily add some posts to a tag / category? This would limit the number of posts being displayed within the widget to only those from the asssigned. Is there a way to say only show the next 5 events in ASC order greater than today’s date? May you please rephrase that? Regards, Rafal

franklin82 2019-04-29T13:04:00+00:00

Hi @gicolek , What i’m looking to do is show any post based on my custom field ‘event-date’ and if the date is greater than todays date shows them in ASC order. Hope that makes more sense. Thanks! Michael

Rafał Gicgier 2019-04-29T13:33:00+00:00

Hey @franklin82 , Does this part of the documentation help you out: The Meta Value field supports an array of elements, so that all of the meta_compare parameters could be used. To do so, please specify the two parameters separated by semicolon, for instance: 1234;12345. The plugin will convert these into an array and apply the proper operation for the two. Whatsmore the [date] shortcode can be used here. It takes the timestamp paramater as an argument, which is required – the possible arguments are the same as for the function described here: http://php.net/manual/pl/function.strtotime.php . For instance [date +1 day] would generate the tomorrow date in “Ymd” format. This can be used with custom meta field date. I’ll do my best to reply ASAP, but can’t promise anything now. Regards, Rafal

franklin82 2019-04-29T14:26:00+00:00

@gicolek , It has helped but but it’s just the order of those posts now, not sure how would be best to do it. No rush on this, this would be the icing on the cake 🙂

Rafał Gicgier 2019-05-13T12:10:00+00:00

Hello again @franklin82 , My apologies for such a huge delay! May you please provide with screenshots of your setup? Please include the following: 1. ACF Custom Fields Setup. 2. Widget / Shortcode setup with the values you have specified. 3. A sample future post setup. I’d like to recreate that directly within my environment to make sure we’re on the same plate here. Sincerely, Rafał

franklin82 2019-05-15T11:43:00+00:00

Hi @gicolek , No problems – thanks for coming back to me, screenshots of the setup for you. ACF Custom Fields Setup Widget sample future post setup I did also change the acfrpw/loop-inner.php (line 61) to the below to include the event-date field. <?php endif; ?> <a href="<?php the_permalink(); ?>" rel="bookmark"> <span class="date meta-item"><?php the_field( 'event-date' ); ?></span> <h3 class="acf-rpw-title"><?php get_the_title() ? the_title() : the_ID(); ?></h3></a> Let me know if you need anything else. Thanks!

Rafał Gicgier 2019-05-15T11:48:00+00:00

Hey @franklin82 , Thanks! I’ll recreate that setup. Can you also share a screenshot of the Event Date field setup? There are some settings that may affect the problem you’re dealing with. Outside of that I don’t need anything else! Sincerely, Rafał

franklin82 2019-05-15T12:23:00+00:00

Hi @gicolek , That should be in the first link included above or do you mean from somewhere else? Thanks, Michael

Rafał Gicgier 2019-05-15T12:28:00+00:00

Hi @franklin82 , Right, but I would like to see the field “open” to see the settings of the date field 🙂 Can you make sure it’s toggled on? Sincerely, Rafal

franklin82 2019-05-15T12:36:00+00:00

@gicolek gotcha, Here you go: https://ibb.co/G038csC Michael

Rafał Gicgier 2019-05-15T12:37:00+00:00

Thanks @franklin82 , That’s exactly it 🙂 I’ll get back to to you tomorrow tops. Thanks for the patience. Regards, Rafal

Rafał Gicgier 2019-05-16T12:38:00+00:00

Hello @franklin82 , Here’s the solution: 1. Widget setup: https://www.screencast.com/t/RpA8IF8kwN6Q (note you can’t use acf meta key within the Meta Value field – it accepts the date only :)) 2. ACF field setup: https://www.screencast.com/t/fXZHfYEpGLo Locally, on Vanilla it gives correct results, not listing older posts: https://www.screencast.com/t/xcDWkFha5 Let me know if that works for you! Cheers, Rafal

franklin82 2019-05-16T13:21:00+00:00

Hey @gicolek thanks for that, I’ll give a go. Do I need to need that code in shown on the last image anywhere, if so where should that be? Thanks! Michael

Rafał Gicgier 2019-05-17T22:35:00+00:00

Hello @franklin82 , No, you don’t – it’s just a debug info that can be ignored. Sorry if that caused some confusion. Sincerely, Rafał This reply was modified 7 years ago by Rafał Gicgier . This reply was modified 7 years ago by Rafał Gicgier .

franklin82 2019-05-20T13:01:00+00:00

Hey @gicolek , Does the ACF field output need to be in ‘Ymd’ format or can this be changed to ‘F j, Y’. In the test you’ve done the date is showing correctly but for me it displays a date like ‘20190523’ which isn’t very friendly. Thanks

Rafał Gicgier 2019-05-20T20:13:00+00:00

Hey @franklin82 , I don’t think so, no. Regards, Rafal

Rafał Gicgier 2019-05-22T11:49:00+00:00

Hey again @franklin82 , Do you think I can mark the topic as resolved? Sincerely, Rafał

franklin82 2019-05-22T13:16:00+00:00

Hey @gicolek , Yeah I think its working as I want it to. Thanks for your help! Michael

Rafał Gicgier 2019-05-22T13:44:00+00:00

Great! @franklin82 do not hesitate to reach to me with any other problem in the future. Also I will appreciate a review of the plugin 🙂 Sincerely, Rafał