• Hi there,

    I am using the My Listing theme and have created a custom field in there. I am now trying to display this on the front end using the following code.

    I understand this may be an theme specific question, but wondered if my code looks ok and would typically be ok to use to display a field?

    <?php
    
    // Get the custom field value
    $custom_field_value = get_post_custom( $post->ID );
    
    // Display the custom field value
    echo $custom_field_value['free-event'];
    
    ?>

    This is a screenshot from my admin:
    https://ibb.co/cYB22FC

    Any suggestions would be great! Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator t-p

    (@t-p)

    Since you use a commercial theme and need support, please go to their official support channel. In order to be good stewards of the WordPress community, and encourage innovation and progress, we feel it’s important to direct people to those official locations.

    https://themeforest.net/item/mylisting-directory-listing-wordpress-theme/20593226/support

    Forum volunteers are also not given access to commercial products, so they would not know why your commercial theme or plugin is not working properly. This is one other reason why volunteers forward you to the commercial product’s vendors. The vendors are responsible for supporting their commercial product. As the developer is aware, commercial products are not supported in these forums.

    Moderator bcworkz

    (@bcworkz)

    I don’t know what get_post_custom() does, so for the reasons t-p already mentioned, I don’t know enough to adequately evaluate your code.

    However, I can offer a couple general observations. Depending on context, $post->ID can be unreliable. Unless you are absolutely certain it’s OK, it’s usually more reliable to use get_the_ID() instead.

    Unless get_post_custom() already does so for you, you should be escaping values from the DB prior to output.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying content from a custom field from My Listing Theme’ is closed to new replies.