• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Display all Custom fields values

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Display all Custom fields values

This topic is: not resolved

Tagged: Custom fields, get_post_meta

  • This topic has 2 replies, 2 voices, and was last updated 9 years, 10 months ago by SchneiderS.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • October 10, 2016 at 7:08 am #194447
    SchneiderS
    Member

    Hello community,

    i searched a lot but found nothing about this problem: i wanna display all the values i added in a the custom fields. For example here: http://prntscr.com/cs2hau

    Here i have one custom field named "leistungen" but with different values. One time with "WLAN" and the other one with "Strom". But the frontend display (http://camplib.com/p/stellplatz-binz-prora/) only the first one. Why is that so?

    The code i used is the following:

    // Display Advanced Custom Fields
    add_action('genesis_entry_header', 'display_custom_fields_anzahl_plaetze');
    
    function display_custom_fields_anzahl_plaetze() {
    if ( is_singular() && genesis_get_custom_field('anzahl_plaetze') )
    echo '<hr /><div id="anzahl_plaetze">Anzahl der Plätze: '. genesis_get_custom_field('anzahl_plaetze') .'</div>';
    }
    
    // Display Advanced Custom Fields
    add_action('genesis_entry_header', 'display_custom_fields_leistungen');
    
    function display_custom_fields_leistungen() {
    if ( is_singular() && genesis_get_custom_field('leistungen') )
    echo '<hr /><div id="leistungen">Leistungen: '. genesis_get_custom_field('leistungen') .'</div>';
    }
    
    // Display Advanced Custom Fields
    add_action('genesis_entry_header', 'display_custom_fields_gebuehren');
    
    function display_custom_fields_gebuehren() {
    if ( is_singular() && genesis_get_custom_field('gebuehren') )
    echo '<hr /><div id="gebuehren">Gebühren: '. genesis_get_custom_field('gebuehren') .'</div>';
    }

    How can i display all the custom fields? Thank you very much for your support!

    http://camplib.com/p/stellplatz-binz-prora/
    October 10, 2016 at 7:21 am #194449
    Brad Dalton
    Participant

    Use this code to get all values for the current post for a specific custom field


    Tutorials for StudioPress Themes.

    November 22, 2016 at 5:18 am #196460
    SchneiderS
    Member

    Hey braddalton,

    thank you very much. i use now this lines:

    // Display Advanced Custom Fields
    add_action('genesis_entry_header', 'display_custom_fields_leistungen');
    
    function display_custom_fields_leistungen() {
    if ( is_singular() && genesis_get_custom_field('leistungen') ){
        $key = get_post_custom_values( 'leistungen' );
        foreach ( $key as $value ) {
        printf( '%s,&nbsp;', $value ); 
        }
      }
    }

    Now i get al values. Thank you.

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble