Home › Forums › Pro Support › PODS and display posts
Tagged: Pods
- This topic has 10 replies, 3 voices, and was last updated 2 years ago by
elvin.
-
AuthorPosts
-
August 3, 2020 at 12:38 pm #17895
Elisabeth
ParticipantHi there
I have two sets of data set up in PODS (‘external events’ and ‘internal events’) and I’d like to display the three next (by date) events for each (internal and external) in two WPShowPost blocks on a static page. I don’t want them to be archive page as the events page needs to include the three forthcoming events in both sets of data, not just be an archive page for one set of events. I am aiming for a block of three ‘external events’ under a heading ‘Forthcoming external events’ and another block of three next internal events under a heading ‘Forthcoming Events from the XYZ Trust’ – the events from each POD are therefore separate and not mixed up.My problem is that when I go into WPShowPosts from the dashboard and create a row of three sets of external posts and then try and populate it with the fields from the PODS data it gives me the post type for ‘external_events’ which is the name of the relevant POD. However, I can’t seem to access any of the other fields I’ve set up in the POD (event location, time of evening, date of event, etc) and it only gives me the ‘standard’ WP post fields.
Can you point me in the right direction for a solution? I’m running WPShowPosts Pro with GeneratePress Premium theme and also playing around a little with BeaverBuilder Pro, Beaver Themer, and Pods using the Beaver Themer PODS integration plugin.
Many thanks as always,
ElisabethAugust 3, 2020 at 1:08 pm #17914Tom
KeymasterHi there,
What exactly are these?:
event location, time of evening, date of event
Are those custom fields? What are you trying to do with them?
August 4, 2020 at 2:04 am #17924Elisabeth
ParticipantThey are descriptions (not the official names) of the custom field set up in PODS. I have about 20 custom fields in the pod – everything from code for iframe google map code, urls for links to organisations running events, a field for speakers, two time fields for start and end time, etc.
I’m trying to use those fields to populate a static page with ‘the next three events’ that are coming up. And I’m trying to use WPShowPosts to do that but it may be the wrong tool, I’m not sure.
I seem – on having looked closer – to have a bigger problem with the PODS not connecting to Beaver Themer. It may be that there is some plugin conflict – I wasn’t aware of this issue when I first posted here yesterday so I’m looking into that now to see if there’s something I’ve done that has completely disconnected the PODS and made them in accessible to both Beaver Themer and WP Show Posts.
In principle, though, if I have set up the POD correctly should WPShowPosts pick up the fields in the custom post types created by a POD?
Thank you
ElisabethAugust 4, 2020 at 2:26 am #17926Elisabeth
ParticipantRight, back again…
Beaver Themer Pods Integration Slack Channel advised clearing cache for BeaverThemer and also PODS. Have now done this and PODS fields are now showing up in Beaver Themer layouts again which is a relief. I still can’t get it all connect with WPShowPosts.
My ideal would be to use a static (and non Beaver Builder/Themer) page – just the standard GeneratePress Pro page with WPShowPosts for this particular events round up page. It’s only going to work if it’s possible for WPShowPosts to pick up custom post types set up within PODS and I’m not sure if that’s a) totally impossible or b) I have missed out a step that would instruct WPShowPosts to recognise these PODS fields.
August 4, 2020 at 1:27 pm #17937Tom
KeymasterOk, so you have two custom posts types with posts within them. You’ve created two WPSP lists, one for each custom post type. Do the posts display?
Now each post type post has a collection of custom fields. Where do you want those fields to display within the lists?
Let me know 🙂
August 5, 2020 at 1:38 am #17950Elisabeth
ParticipantI have created a short loom video to explain what I’m trying to do – it’s the easiest way I can find of sharing the info with you. I’ll send you the link via your contact page.
Thank you
ElisabethAugust 5, 2020 at 1:00 pm #17963Tom
KeymasterThanks for the video!
WP Show Posts isn’t “smart” enough to detect custom fields for post types, unfortunately.
What you’d need to do is hook those custom fields into the posts.
For example, if you had a custom field with
my_custom_field
as the name, you could do this:add_action( 'wpsp_after_title', function( $settings ) { if ( 123 === $settings['list_id'] ) { $custom_field = get_post_meta( get_the_ID(), 'my_custom_field', true ); if ( $custom_field ) { echo $custom_field; } } } );
So this checks for the list ID, and then adds the value from your specified custom field after the title if it exists.
Not overly easy, but quite powerful once you get the functions going.
Let me know if that helps at all 🙂
August 6, 2020 at 2:43 am #17993Elisabeth
ParticipantThank you very much for taking the time to watch the video and for the information above.
I may get stuck with implementing the bit where you say ‘hook those custom fields into the posts’ but if so I’ll be back – off to research a bit before admitting defeat.
GeneratePress and related plugins by you are such an excellent starting point for me as they make it very possible/motivating to learn this more complex stuff.
Thank you, as always.
ElisabethAugust 6, 2020 at 2:46 pm #18011Tom
KeymasterI’m happy to help if you get stuck. Best thing to do is copy my code above and update the list ID and custom field name, then see what it does. Just be sure that the custom field name is correct and that it has a value for the post it’s supposed to show up inside.
May 5, 2021 at 3:42 am #29908Elisabeth
ParticipantHi there
Just coming back to this question – am I right in thinking that the Beta release of the most recent version of GeneratePress pro now enables this ability to pull in custom post type fields?
Thank you
LizMay 6, 2021 at 12:44 am #29923elvin
ModeratorHi there
Just coming back to this question – am I right in thinking that the Beta release of the most recent version of GeneratePress pro now enables this ability to pull in custom post type fields?
Thank you
LizHi there,
Yes, GP Premium 2.0’s Block Element allows for Dynamic contents taken from custom fields assigned to whatever post type. 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.