• Resolved ohlookitsdany

    (@ohlookitsdany)


    I work for a small nonprofit, and a while back on an older version of WordPress, I created a custom post type that has a bunch of custom metadata fields. Now we’re working on a brand refresh and I’ve upgraded us to WordPress 6.5.5 and thought I’d rebuild our theme using Twenty Twenty-Four as a base, since the new site editor would streamline things for us. However, I’m having trouble querying for those custom fields in the custom post type.

    The Query Loop block sees the custom post type, and even allows me to filter by our custom taxonomies, but in the “Post Template” part of the query loop block, I’d like to display some of that custom metadata (certification type and location in this specific instance) if available. (You can see our existing card display and what I’m trying to replicate here: https://living-future.org/program/lbc/)

    On previous versions of WordPress, I’ve had a “case-studies-card.php” file that displays that information like so:

    <?php
    $certification = get_post_meta($post->ID, 'cert_type_dropdown', true);
    $location = get_post_meta($post->ID, 'location_text', true);
    ?>
    ...
    <div class="post-card__primary">
    ...
    <?php else : ?>
    <?php the_title( '<h2 class="post-card__title mdc-typography mdc-typography--headline6">', '</h2>' ); ?>
    <?php endif; ?>
    <h4 class="post-card__subtitle mdc-typography mdc-typography--subtitle2"><?php echo $certification ?></h4>
    </div>
    <div class="post-card__secondary mdc-typography mdc-typography--body2">
    <p><?php echo $location ?></p>
    </div>

    I’m trying to basically add that as a pattern that I can drop into a Query Loop block, but I can’t get it to display that information.

    The page I need help with: [log in to see the link]

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