Display images of related posts

I’m fetching the attachment ID by get_post_thumbnail_id function which is taking the post ID. After getting the attachment ID of that post, I am passing this attachment ID to wp_get_attachment_image_src function and getting the image details. So I am rewriting your foreach loop like this way foreach($related as $r) { $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id($r->ID), ‘thumbnail’, … Read more

post thumbnails error

Are you added add_theme_support( ‘post-thumbnails’ ); line into functions.php file of your theme? Also check the loop. Are you added the_post_thumbnail() function there?

featured image metabox not moving custom post type

Hope this code may be help you. You can read the full parameters for add_meta_box in the codex. I also listed them here: add_meta_box( $id, $title, $callback, $page, $context, $priority, $callback_args ); function wpt_add_event_metaboxes() { add_meta_box( ‘wpt_events_location’, // $id ‘Event Location’, // $title ‘wpt_events_location’, // $callback ‘events’, // $page (Post Type) ‘side’, // $context ‘default’ … Read more

Change wording of default thumbnail metabox

This is usually what I go with: /** Use “Featured Image” Box As A Custom Box **/ function customposttype_image_box() { remove_meta_box(‘postimagediv’, ‘page’, ‘side’); add_meta_box(‘postimagediv’, __(‘Set Dat Image’), ‘post_thumbnail_meta_box’, ‘page’, ‘side’); } add_action(‘do_meta_boxes’, ‘customposttype_image_box’); /** Change “Featured Image” box Link Text **/ function custom_admin_post_thumbnail_html( $content ) { global $post; if($post->post_type == ‘page’) { $content = str_replace( … Read more