WP_query instead of rmwb_meta

Support General WP_query instead of rmwb_meta

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #31536
    info@ceescoenen.nl[email protected]
    Participant

    I will add the WP_query to get related posts. I have a CPT DOEN. Each post has one or more related posts using the post-field. The default code rmwb_meta works but I want the Advanced Query Builder in Oxygen to get the related ID's.
    What is the correct WP_query?

    global $post;
    
    $field_id = "hoogtepunten";
    $post_id = rwmb_meta( $field_id );
    
    if ( $post_id) {
        echo '<h2 class="related-content-title">Bezienswaardigheden langs de route</h2>';
    
    echo '<div class="related-content">';
    
    foreach( $post_id as $post) {
        setup_postdata( $post ); ?>
    #31551
    Long NguyenLong Nguyen
    Moderator

    Hi Cees,

    Please notice that the helper function rwmb_meta() retrieves the field value (or called post meta), it is a parameter of WP_Query to get the posts.

    You can read more on Oxygen documentation https://oxygenbuilder.com/documentation/other/advanced-query-builder/
    and WordPress WP_Query https://developer.wordpress.org/reference/classes/wp_query/#custom-field-post-meta-parameters

    If you don't want to use the helper function rwmb_meta(), you can use the WordPress function get_post_meta().

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