We're merging with GenerateBlocks! Learn more here.

Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Output Custom Field in Div Class Reply To: Output Custom Field in Div Class


Hello I have a custom field in some posts (prod1). Is an url link to an image (ej: https://www.iluminet.com/press/wp-content/uploads/2019/01/Konica-mini.jpg). If I use the code:

add_action( 'wpsp_after_content', 'tu_add_custom_meta' );
function tu_add_custom_meta() {
    $meta = get_post_meta( get_the_ID(), 'prod1', true );
    if ( isset( $meta ) && '' !== $meta ) {
        echo '<div class="my-class-here">' . $meta . '</div>';

or use echo esc_url( get_post_meta( get_the_ID(), 'prod1', true ) );

I just get the text (https://www.iluminet.com/press/wp-content/uploads/2019/01/Konica-mini.jpg) below the title, not the image, I need that as the image. Is it possible?

Thank you