We're merging with GenerateBlocks! Learn more here.

[Resolved] Displaying a custom post type with custom fields

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Displaying a custom post type with custom fields

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #21868
    Tom
    Participant

    Hey there!

    I just downloaded WP Show Posts and instantly bought Pro. Looks like exactly what I need. I do need some help to set it up though.

    I have a custom post type for “Tours”, with some custom fields. In the front end I’m using WP Bakery Page Builder that’s shipped with the Salient theme. In the Page Builder I can use the shortcode in a text block, so that’s great.

    Now I need to know how I can display the tour with all it’s custom fields in a card on the front end. Styling will be done through CSS I guess, so my question is mainly how to add these custom fields to this plugin. And also how I can give these html elements classes so I can style them.

    Thank you!
    Tom

    #21874
    Tom
    Participant

    Never mind, I got it! For future reference:

    I found this code snippet:

    add_action( 'wpsp_before_content', function( $settings ) {
        if ( 373 === $settings['list_id'] ) {
            $meta = get_post_meta( get_the_ID(), 'duration', true );
    
            if ( $meta ) {
                echo '</p>This trip will take ' . $meta . ' hours<p>';
            }
        }
    } );

    But the post didn’t mention that you should change the number of the list id, and that you can find it by looking at the shortcode you’re using. Within the echo part you can add HTML.

    #21911
    Tom
    Keymaster

    Glad you found the solution! Thanks for posting it here 🙂

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