Support Forum » User Profile

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • DeveloperDeveloper
    Participant

    Same issue for me.

    How do we fix this?

    in reply to: How to display Single Image? #40583
    DeveloperDeveloper
    Participant

    Peter,

    I got it figured out. The custom field group I am using is for a Post Type, not a Taxonomy, so I believe that term ID doesn't actually come into play. This was obviously my misunderstanding.

    Here is the working snippet if it helps anyone in the future. I simply needed to add the post ID to my initial code, where post ID is 123 in this example:

    function shortcode_function(){
    	$image = rwmb_meta( 'custom_field_item', ['size' => 'thumbnail'], 123 );
    	return '<img src="' . $image['url'] . '">';
    }
    add_shortcode('my-shortcode', 'shortcode_function');
    in reply to: How to display Single Image? #40567
    DeveloperDeveloper
    Participant

    Hey Peter,

    Thank you for your response.

    The custom field, custom_field_item, that I am using is a Single Photo field on a page with the post ID of 39.

    I am attempting to display the image saved to the custom field on a different page on the site.

    I know how to find a post ID by hovering over a page in the WP admin and viewing the ID as part of the URL, but I am unsure how to find the term ID of the custom field. Are they one in the same? Is it different? This seems to be where I'm getting tripped up.

Viewing 3 posts - 1 through 3 (of 3 total)