[Support request] PODS and display posts

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support PODS and display posts

Tagged: 

  • This topic has 8 replies, 2 voices, and was last updated 4 months ago by Tom.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #17895
    Elisabeth
    Participant

    Hi 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,
    Elisabeth

    #17914
    Tom
    Keymaster

    Hi 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?

    #17924
    Elisabeth
    Participant

    They 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
    Elisabeth

    #17926
    Elisabeth
    Participant

    Right, 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.

    #17937
    Tom
    Keymaster

    Ok, 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 🙂

    #17950
    Elisabeth
    Participant

    I 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
    Elisabeth

    #17963
    Tom
    Keymaster

    Thanks 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 🙂

    #17993
    Elisabeth
    Participant

    Thank 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.
    Elisabeth

    #18011
    Tom
    Keymaster

    I’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.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.